Table of Contents

Class GovernancePolicyAttribute

Namespace
AsiBackbone.AspNetCore.Endpoints
Assembly
AsiBackbone.AspNetCore.dll

Marks an ASP.NET Core endpoint with the host-defined AsiBackbone policy type that governs it.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public sealed class GovernancePolicyAttribute : Attribute, IEndpointGovernancePolicyMetadata, IEndpointGovernanceMetadata
Inheritance
GovernancePolicyAttribute
Implements
Inherited Members

Remarks

The recorded type is a marker, not an enforcement rule. The framework does not resolve it or select constraints from it: the registered policy evaluator evaluates every registered constraint on every governed endpoint, whichever policy type an endpoint carries. Presence of this attribute is what causes policy evaluation to run at all; the type identifies which policy the host intends, and reaches evaluation as the endpoint.policy_types metadata entry where a host-supplied decision policy can read it. Marking two endpoints with different policy types does not by itself make them evaluate differently.

Named RequireGovernancePolicyAttribute before 6.0. The route-builder extension of the same name became MarkGovernancePolicy because "Require" overstated what the marker does; the attribute is renamed for the same reason, so the attribute and route-builder paths use consistent vocabulary.

Initializes a new instance of the GovernancePolicyAttribute class.

Constructors

GovernancePolicyAttribute(Type)

Marks an ASP.NET Core endpoint with the host-defined AsiBackbone policy type that governs it.

public GovernancePolicyAttribute(Type policyType)

Parameters

policyType Type

The host-defined policy marker or decision policy type associated with the endpoint.

Remarks

The recorded type is a marker, not an enforcement rule. The framework does not resolve it or select constraints from it: the registered policy evaluator evaluates every registered constraint on every governed endpoint, whichever policy type an endpoint carries. Presence of this attribute is what causes policy evaluation to run at all; the type identifies which policy the host intends, and reaches evaluation as the endpoint.policy_types metadata entry where a host-supplied decision policy can read it. Marking two endpoints with different policy types does not by itself make them evaluate differently.

Named RequireGovernancePolicyAttribute before 6.0. The route-builder extension of the same name became MarkGovernancePolicy because "Require" overstated what the marker does; the attribute is renamed for the same reason, so the attribute and route-builder paths use consistent vocabulary.

Initializes a new instance of the GovernancePolicyAttribute class.

Properties

PolicyType

Gets the host-defined policy marker or resolver type associated with the endpoint.

public Type PolicyType { get; }

Property Value

Type