A simple event bus helper.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Was.EventBus.Autofac.Tests
Was.EventBus.Autofac
Was.EventBus.MiniAutFac.Tests
Was.EventBus.MiniAutFac
Was.EventBus.Tests
Was.EventBus
.gitattributes
.gitignore
README.md
Was.EventBus.sln

README.md

Was.EventBus

A simple event bus helper.

Details

Was.EventBus provides classes for budilding a proxy class that invokes multiple implementation of interfaces.

interface IInfo
{
    void SetInfo(string info);
}

var oneInfo = new SomeInfoImplementation();
var twoInfo = new OtherInfoImplementation();

var implementationProvider = new SingleTypeProvider(new[] { oneInfo, twoInfo }, typeof(IInfo));

IInfo info = MultiInterfaceProxy.For(typeof(IInfo), implementationProvider);
info.SetInfo("Some info"); // a call is passed to oneInfo and twoInfo - both are called.

Autofac integration

There is an module for integrating Was.EventBus with autofac:

interface IInfo : IEvent
{
     void SetInfo(string info);
}

builder.RegisterModule(new EventBusModule(new[] { Assembly.GetCallingAssembly() })); // assemblies to search types for - events are automatically registered in container builder

...
container.Resolve<IInfo>().SetInfo("Some info"); 
// implementations are automatically found, resolved are invoked.