Skip to content

Map-From binding

Supports a variety of map-from bindings:

  1. Path - MapFromPathAttribute
  2. Query - MapFromQueryAttribute
  3. Header - MapFromHeaderAttribute
  4. Cookie - MapFromQueryAttribute
  5. Manual

Simply decorate your request dto property (must be read and write) with the corresponding 'MapFromAttribute'

You also need to specify the name of the key it should be taken from.

Supported types

Supported Bindings

Path

public record QueryDto
{
    [MapFromPath("Id")] public long Id { get; set; }
}

Query

public record QueryDto
{
    [MapFromQuery("Id")] public long Id { get; set; }
}
public record QueryDto
{
    [MapFromHeader("Id")] public long Id { get; set; }
}
public record QueryDto
{
    [MapFromCookie("Id")] public long Id { get; set; }
}

Manual

See mappers