KestrunHostMapExtensions.ApplyKestrunConventions method

Applies the same route conventions used by the AddMapRoute helpers to an arbitrary endpoint.

public static IEndpointConventionBuilder ApplyKestrunConventions(this KestrunHost host, 
    IEndpointConventionBuilder builder, Action<MapRouteOptions> configure)
parameter description
host The Kestrun host used for validation (auth schemes/policies).
builder The endpoint convention builder to decorate.
configure Delegate to configure a fresh MapRouteOptions instance. Only applicable properties are honored.

Return Value

The original builder for fluent chaining.

Remarks

This is useful when you map endpoints manually via app.MapGet/MapPost and still want consistent behavior (auth, CORS, rate limiting, antiforgery disable, OpenAPI metadata, short-circuiting) without re-implementing logic. Validation notes: - Pattern, Code are ignored if not relevant. - Authentication schemes and policies are validated against the host registry. - OpenAPI metadata is applied only when non-empty.

See Also