[FromRoute]
noun
say it: “frum-ROWT” /frəmˈraʊt/
An ASP.NET Core attribute that says an action parameter's value comes from the route.
What does [FromRoute] mark in ASP.NET Core?
[FromRoute] — An attribute on an action parameter that says its value comes from the route, such as the 7 in /products/7, and from nowhere else. Model binding would usually find it anyway; the attribute makes it explicit.
[HttpGet("products/{id}")]
public IActionResult Details([FromRoute] int id) => View(productDao.GetById(id));
In a sentence
- “I marked id with FromRoute so it's clear the 7 comes from /products/7.”
Level: Apprentice · More ASP.NET Core terms at this level
Updated