Table of Contents

Struct MiddlewareEntry

Namespace
Excalibur.Dispatch
Assembly
Excalibur.Dispatch.Abstractions.dll

Declares a single middleware within a pipeline profile, together with whether the built pipeline may omit it.

public readonly record struct MiddlewareEntry : IEquatable<MiddlewareEntry>
Implements
Inherited Members
Extension Methods

Remarks

This type is the single authoritative declaration of a profile's middleware. A profile exposes entries and nothing else, so the criticality of an entry cannot become separated from the type it applies to.

The default is deliberate. A profile that names a middleware and omits its criticality has asked for protection without saying how much, which is materially different from declaring the entry optional. Callers that genuinely want a best-effort entry state Optional explicitly.

The constructor default governs only entries created through the constructor. A value of this type obtained without running it - the default value, or an unfilled slot of an array - holds Unspecified and a null MiddlewareType. Neither is a usable entry, and building a pipeline from one fails rather than resolving it to a criticality nobody stated. That is why the zero value is Unspecified and not a real criticality: the unsafe outcome is not reachable by omitting anything.

Constructors

MiddlewareEntry(Type, MiddlewareCriticality)

Declares a single middleware within a pipeline profile, together with whether the built pipeline may omit it.

public MiddlewareEntry(Type MiddlewareType, MiddlewareCriticality Criticality = MiddlewareCriticality.Required)

Parameters

MiddlewareType Type

The middleware implementation type to include in the pipeline. Its public constructors are preserved under trimming: the type flows into activation and into the pipeline's scope walk, and a walk that cannot see a constructor cannot classify the type correctly.

Criticality MiddlewareCriticality

Whether the entry may be skipped when it cannot be materialized. Callers that use this constructor and omit the argument get Required, so a profile that declares a middleware without stating a criticality gets the protection it named rather than a silent omission. Values obtained without running this constructor hold Unspecified instead, which no pipeline will build.

Remarks

This type is the single authoritative declaration of a profile's middleware. A profile exposes entries and nothing else, so the criticality of an entry cannot become separated from the type it applies to.

The default is deliberate. A profile that names a middleware and omits its criticality has asked for protection without saying how much, which is materially different from declaring the entry optional. Callers that genuinely want a best-effort entry state Optional explicitly.

The constructor default governs only entries created through the constructor. A value of this type obtained without running it - the default value, or an unfilled slot of an array - holds Unspecified and a null MiddlewareType. Neither is a usable entry, and building a pipeline from one fails rather than resolving it to a criticality nobody stated. That is why the zero value is Unspecified and not a real criticality: the unsafe outcome is not reachable by omitting anything.

Properties

Criticality

Whether the entry may be skipped when it cannot be materialized. Callers that use this constructor and omit the argument get Required, so a profile that declares a middleware without stating a criticality gets the protection it named rather than a silent omission. Values obtained without running this constructor hold Unspecified instead, which no pipeline will build.

public MiddlewareCriticality Criticality { get; init; }

Property Value

MiddlewareCriticality

MiddlewareType

The middleware implementation type to include in the pipeline. Its public constructors are preserved under trimming: the type flows into activation and into the pipeline's scope walk, and a walk that cannot see a constructor cannot classify the type correctly.

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
public Type MiddlewareType { get; init; }

Property Value

Type