Class EndpointGovernanceApplicationBuilderExtensions
- Namespace
- AsiBackbone.AspNetCore.Endpoints
- Assembly
- AsiBackbone.AspNetCore.dll
Provides ASP.NET Core application builder extensions for AsiBackbone endpoint governance.
public static class EndpointGovernanceApplicationBuilderExtensions
- Inheritance
-
EndpointGovernanceApplicationBuilderExtensions
- Inherited Members
Methods
UseAsiBackboneEndpointGovernance(IApplicationBuilder, bool)
Adds AsiBackbone endpoint governance middleware to the ASP.NET Core pipeline.
public static IApplicationBuilder UseAsiBackboneEndpointGovernance(this IApplicationBuilder app, bool requireEndpointRoutingRegistered = false)
Parameters
appIApplicationBuilderThe application builder.
requireEndpointRoutingRegisteredboolWhen true, throws if endpoint routing has not been registered before this call. Only use this in hosts that call
UseRoutingexplicitly.
Returns
- IApplicationBuilder
The same application builder so calls can be chained.
Remarks
This middleware governs the selected endpoint, so it must run after endpoint routing has selected one.
Placed before routing, every request reaches it with no endpoint, no governance metadata is found, and the
request is forwarded ungoverned unless RequireGovernanceMetadata
is enabled. Register it after UseRouting and after authentication, so an actor context is available.
A host that calls UseRouting explicitly can pass requireEndpointRoutingRegistered to
turn that ordering requirement into a startup failure. It is off by default because it cannot be checked
reliably: a Minimal API host that never calls UseRouting still routes correctly, because
WebApplication inserts routing at the front of the pipeline when endpoints are mapped, and in that case
the routing marker is legitimately absent when this method runs.
Exceptions
- ArgumentNullException
Thrown when
appis null.- InvalidOperationException
Thrown when
requireEndpointRoutingRegisteredis true and endpoint routing has not been registered before this call.