Skip to content

tommililja/MediatR.BehaviorProfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MediatR.BehaviorProfiles

Profiles that simplify the registration of MediatR behaviors.

Usage

Create a profile:

using MediatR.BehaviorProfiles;

public class MyBehaviorProfile : BehaviorProfile
{
    public override void Configure()
    {
        Register(typeof(LoggingBehavior<,>));

        Register(typeof(TransactionBehavior<,>), handlers =>
        {
            handlers.Include<CreateOrderHandler>();
            handlers.Include<DeleteOrderHandler>();
        });
    }
}

Add the profile in ConfigureServices:

using MediatR.BehaviorProfiles.Extensions;

public void ConfigureServices(IServiceCollection services)
{
    services
        .AddMediatR()
        .AddBehaviorProfile<MyBehaviorProfile>();     
}

Dependencies

About

Behavior profiles for MediatR

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages