A plain old CLR object (POCO) is a normal .NET class that carries data without framework-specific inheritance, dependencies, attributes, infrastructure concerns, special types, or unrelated responsibilities. Its properties can be serialized into JSON, making it useful for representing data returned by a web API. section 2.4.4
A POCO supports a small API feature by:
- Defining data as ordinary properties, such as Id, Name, and Year on a BoardGame class. section 2.4.5
- Providing objects that a controller can return as a JSON array from an HTTP GET action. section 2.4.4 section 2.4.5
- Keeping data representation separate from controller responsibilities and framework behavior. section 2.4.4
Listing 2.3 BoardGame.cs file
namespace MyBGList
{
public class BoardGame
{
public int Id { get; set; }
public string? Name { get; set; }
public int? Year { get; set; }
}
}
Inspect the compact BoardGame class, which uses ordinary properties to model sample board-game data. section 2.4.5
Replacing the template data object
Delete WeatherForecast.cs, add BoardGame.cs, and define a class with Id, Name, and Year properties. A BoardGamesController can then return three BoardGame objects at the /BoardGames route. The same sample output can be produced with Minimal API, but the controller remains useful when data retrieval and updates become more complex. section 2.4.5

