Last active
December 26, 2015 20:49
-
-
Save mookid8000/7211294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Action<MyDomainAssembly.ISubscribeTo<MyDomainAssembly.IDomainEvent>, MyDomainAssembly.IDomainEvent> | |
dispatchSpecification = (s, e) => s.Handle(e); | |
Action<MyDomainAssembly.IDomainEvent> myDispatcher = | |
DomainEvents.Configure.With(someIocContainerAdapter) | |
.DefineSubscriberAs<MyDomainAssembly.ISubscribeTo<MyDomainAssembly.IDomainEvent>>(dispatchSpecification) | |
.RegisterSubscribersFromAssemblyContaining<MyDomainAssembly.SomeConcreteSubscriber>(Lifestyle.InstancePerCall) | |
.RegisterSubscribersFromAssemblyContaining<MyInfrastructureAssembly.AnotherConcreteSubscriber>(Lifestyle.InstancePerCall) | |
.CreateDispatcher(); | |
// static dependency injection | |
MyDomainAssembly.DomainEvents.SetDispatcher(myDispatcher); | |
// from now on, domain can go | |
DomainEvents.Raise(new SomeDomainEvent()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment