liveBook · Manning

FromQuery attribute

The FromQuery attribute directs ASP.NET Core model binding to obtain a parameter or property value from the request URL's query string.

How 3 Manning books explain it

ASP.NET Core in Action, 3e

The FromQuery attribute is an ASP.NET Core parameter-binding attribute that specifies binding a parameter from query-string data and can name the query target.

How it is used
Directs minimal API handler parameters to query-string values when explicit binding or query-key naming is useful.
How deep it goes
Explains explicit-source precedence, target naming, repeated-value arrays, and 400 responses, but defers custom binding internals.
Examples
Demonstrates paged product endpoints and repeated product IDs renamed through FromQuery(Name).
What you can do after
Apply it via ASP.NET Core minimal APIs to select query binding and map repeated or differently named query keys.

Read how ASP.NET Core in Action, 3e explains FromQuery attribute →

Building Web APIs with ASP.NET Core

The FromQuery attribute directs ASP.NET Core model binding to obtain a parameter's value from the request query string.

How it is used
Binds complex GET-action parameters from query-string values while preserving the behavior of separate simple parameters.
How deep it goes
Explains explicit complex-parameter binding, alternatives, and DTO property usage, but does not detail binder internals.
Examples
Uses BoardGamesController.Get with RequestDTO input and demonstrates filtering, sorting, pagination, and response construction.
What you can do after
Apply it via ASP.NET Core to bind a request DTO’s properties from GET query parameters.

Read how Building Web APIs with ASP.NET Core explains FromQuery attribute →

Pro ASP.NET Core 7, Tenth Edition

The FromQuery attribute directs ASP.NET Core model binding to obtain a parameter value from the request URL's query string.

How it is used
Selects query-string data when default model-binding source precedence is unsuitable or must be made explicit.
How deep it goes
Demonstrates parameter and property binding, name overrides, conflicting route values, and structured query-string data.
Examples
Uses a conflicting `/index/5?id=1` URL, a bound Product array, and a supplier-creation breakout initiated by GET.
What you can do after
Apply it via ASP.NET Core model binding to force parameters or properties to read named values from query strings.

Read how Pro ASP.NET Core 7, Tenth Edition explains FromQuery attribute →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.