Table of Contents

Class ProgressiveEnhancementExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Excalibur.Dispatch.dll

Progressive enhancement extension methods for IDispatchBuilder.

public static class ProgressiveEnhancementExtensions
Inheritance
ProgressiveEnhancementExtensions
Inherited Members

Remarks

These extensions provide a layered approach to adding Dispatch features. Start minimal and progressively add capabilities as needed:

// Minimal (MediatR replacement)
services.AddDispatch();

// With specific features services.AddDispatch() .UseContextEnrichment() .UseValidation();

// Full-featured mode services.AddDispatch() .UseAllFeatures();

Note: Inbox/Outbox require explicit store configuration and are not included in UseAllFeatures(IDispatchBuilder). Use WithInbox<TStore>() and WithOutbox<TStore>() separately.

Methods

UseAllFeatures(IDispatchBuilder)

Adds all standard Dispatch features available in the core package.

public static IDispatchBuilder UseAllFeatures(this IDispatchBuilder builder)

Parameters

builder IDispatchBuilder

The dispatch builder.

Returns

IDispatchBuilder

The dispatch builder for method chaining.

Remarks

This is a convenience method that combines the following core extensions:

Note: The following require separate packages and should be added explicitly:

  • UseContextObservability() - Requires Excalibur.Dispatch.Observability package
  • UseResilience() - Requires Excalibur.Dispatch.Resilience.Polly package
  • WithInbox<TStore>() / WithOutbox<TStore>() - Require store provider choice

Full-featured example with all packages:

services.AddDispatch()
    .UseAllFeatures()
    .UseContextObservability()                // From Excalibur.Dispatch.Observability
    .UseResilience()                          // From Excalibur.Dispatch.Resilience.Polly
    .WithInbox<InMemoryInboxStore>()
    .WithOutbox<SqlServerOutboxStore>();

Exceptions

ArgumentNullException

Thrown when builder is null.

UseContextEnrichment(IDispatchBuilder)

Adds context enrichment capabilities to the dispatch pipeline.

public static IDispatchBuilder UseContextEnrichment(this IDispatchBuilder builder)

Parameters

builder IDispatchBuilder

The dispatch builder.

Returns

IDispatchBuilder

The dispatch builder for method chaining.

Remarks

Context enrichment enables full message context tracking including:

  • Full IMessageContext with Items dictionary
  • Correlation ID propagation across message flows

AsyncLocal context flow via IMessageContextAccessor is NOT gated behind this call -- the base pipeline (AddDispatch()) already registers it unconditionally, so every consumer has ambient context flow whether or not UseContextEnrichment(IDispatchBuilder) is called.

This is distinct from UseContextObservability() which focuses on telemetry (OpenTelemetry spans, metrics, and logging). Use both for complete context support.

Exceptions

ArgumentNullException

Thrown when builder is null.