Table of Contents

Class TransactionPipelineExtensions

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

Extension methods for adding transaction middleware to the dispatch pipeline.

public static class TransactionPipelineExtensions
Inheritance
TransactionPipelineExtensions
Inherited Members

Methods

UseTransaction(IDispatchBuilder)

Adds transaction middleware to the dispatch pipeline.

public static IDispatchBuilder UseTransaction(this IDispatchBuilder builder)

Parameters

builder IDispatchBuilder

The dispatch builder.

Returns

IDispatchBuilder

The builder for fluent configuration.

Remarks

The transaction middleware wraps downstream handlers in a transaction scope, ensuring that all operations within a single dispatch are committed or rolled back atomically.

Transaction services must be registered separately in the DI container. This method only adds the middleware to the pipeline.

Recommended pipeline order:

builder.UseAuthentication()
       .UseAuthorization()
       .UseValidation()
       .UseTransaction()         // Wrap handler execution in a transaction
       .UseOutbox();