79585979

Date: 2025-04-22 08:21:28
Score: 0.5
Natty:
Report link

As others have said netcore will identify the most appropriate binding - it's helpful to understand how to control this in more detail - see here for the Microsoft documentation on it:

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis/parameter-binding?view=aspnetcore-9.0#explicit-parameter-binding

below is an example of a Get request where you can see explicit control of where to expect parameters to come from

app.MapGet("/{id}", ([FromRoute] int id,
                     [FromQuery(Name = "p")] int page,
                     [FromServices] Service service,
                     [FromHeader(Name = "Content-Type")] string contentType) 
                     => {});

It may also help to look around Model Binding in asp.net core as that also helps explain how it all works: https://learn.microsoft.com/en-us/aspnet/core/mvc/advanced/custom-model-binding?view=aspnetcore-9.0
HTH

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Nick Pattman