Model binding turns incoming HTTP request values into the typed parameters an ASP.NET Core action method expects. Request values arrive as strings; the framework retrieves and converts them automatically, rather than requiring the action method to parse each one. section 6.1.1
A board-game list request
For GET /BoardGames?pageIndex=2&pageSize=50, model binding converts "2" and "50" to integers and supplies them to the Get action. If sorting or filtering parameters are omitted, their configured defaults can be used. An unconvertible pageIndex, such as "string", is a binding error rather than a value the action must interpret. section 6.1.1 section 6.1
public async Task<RestDTO<BoardGame[]>> Get( int pageIndex = 0, int pageSize = 10, string? sortColumn = "Name", string? sortOrder = "ASC", string? filterQuery = null)
The action signature shows the expected parameter types and defaults for omitted pagination, sorting, and filtering values. section 6.1.1
Binding also works with a complex type such as a request DTO: each property is bound and validated like an individual parameter. This keeps a growing list of pagination, sorting, and filtering inputs in one class. Put [FromQuery] on the DTO parameter when those values should continue to come from the query string. Property initializers provide defaults; the example also uses [DefaultValue] so generated Swagger documentation can display them. section 6.1.5
Conversion is only the first check. Validation attributes can impose rules on parameters or DTO properties: for example, [Range(1, 100)] on PageSize rejects an excessive page size without a manual conditional. Custom validation attributes and IValidatableObject can handle further checks. section 6.1.2 section 6.4
With [ApiController], the framework binds inputs, then validates them and records validation results in ModelState. A binding failure or invalid model produces HTTP 400 before the action runs. This is convenient for ordinary invalid requests; checking ModelState manually is an option when the validation response needs customization. section 6.2.1 section 6.4


