Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Created March 1, 2026 13:23
Show Gist options
  • Select an option

  • Save wullemsb/088f50946f2cf4404da9c0f3e3259d22 to your computer and use it in GitHub Desktop.

Select an option

Save wullemsb/088f50946f2cf4404da9c0f3e3259d22 to your computer and use it in GitHub Desktop.
public class GetOrderParams
{
[FromRoute]
public int OrderId { get; set; }
[FromHeader(Name = "X-Tenant-Id")]
public string TenantId { get; set; } = default!;
[FromQuery]
public bool IncludeLineItems { get; set; }
}
app.MapGet("/orders/{orderId}", ([AsParameters] GetOrderParams p, OrdersDb db) =>
{
// p.OrderId — from route
// p.TenantId — from request header
// p.IncludeLineItems — from query string
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment