Skip to content
/ bdiator Public

A very simple mediator pattern implementation, pronounced as Mediator but with the letter B =)

Notifications You must be signed in to change notification settings

b03tz/bdiator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BDiator

A very simple mediator pattern implementation, pronounced as Mediator but with the letter B =)

Easily register multiple handlers for messages. No need for any specific implementation of BDiator so no dependencies in your use layers.

Example usage:

var bdiator = new BDiator(new HandlerProvider());
bdiator.Subscribe<IMessageHandler<IMessage>, IMessage>();
bdiator.Subscribe<IEventHandler<IEvent>, IEvent>();

await bdiator.HandleAsync(new UpdatedEvent()
{
    UpdatedTime = DateTime.Now
});

await bdiator.HandleAsync(new CreatedEvent()
{
    EventDetails = new CreatedEventDetails()
    {
        Id = Guid.NewGuid()
    }
});

await bdiator.HandleAsync(new NotifiedMessage()
{
    Message = "Notified from other type of handler!"
});

Setup the handler provider to get your eventhandlers from a DI system and off you go!

About

A very simple mediator pattern implementation, pronounced as Mediator but with the letter B =)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages