[FromQuery]

noun

say it: “frum-KWEER-ee” /frəmˈkwɪəri/

An ASP.NET Core attribute that says an action parameter's value comes from the query string.

What is [FromQuery]?

[FromQuery] says a parameter comes from the query string, like ?page=2. Simple types not in the route come from the query by default.

app.MapGet("/recipes", ([FromQuery] int page = 1, [FromQuery] int pageSize = 20) => ...);

In a sentence

  • “FromQuery on page reads the 2 from ?page=2.”

Level: Apprentice · More ASP.NET Core terms at this level

Updated