Distributed Unit of Work Behavior

Distributed Unit of Work Behavior in MediatR pipeline within RCommon.

The distributed unit of work behavior is useful any time you want to de-couple your transaction handling from your application logic. It can be added by doing this in your dependency injection section. The Distributed Unit of Work behavior is really only useful when coupled with Persistence and distributed events.

protected void InitializeRCommon(IServiceCollection services)
{

    ConfigureRCommon.Using(new DotNetCoreContainerAdapter(Services))
        .WithStateStorage<DefaultStateStorageConfiguration>()
        .WithPersistence<EFCoreConfiguration>(x =>
            x.UsingDbContext<LeaveManagementDbContext>())
        .And<DataServicesConfiguration>(x =>
            x.WithUnitOfWork<DefaultUnitOfWorkConfiguration>())
        .AddDistributedUnitOfWorkToMediatorPipeline())
        .WithMassTransit(MassTransitBootstrapper.GetBaseConfig());
}

Last updated