Created
January 20, 2015 21:11
-
-
Save sstorie/0c48a7fcea769e37c281 to your computer and use it in GitHub Desktop.
Registry code
This file contains 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
public class DefaultRegistry : Registry { | |
#region Constructors and Destructors | |
public DefaultRegistry() { | |
Scan( | |
scan => { | |
scan.TheCallingAssembly(); | |
// Ensure the assembly with our IMediator interface is loaded | |
// | |
scan.AssemblyContainingType<IMediator>(); | |
// Pull in all implementations of the request and notifications handlers | |
// automatically | |
// | |
scan.AddAllTypesOf(typeof(IRequestHandler<,>)); | |
scan.AddAllTypesOf(typeof(INotificationHandler<>)); | |
scan.AddAllTypesOf(typeof(IPreRequestHandler<>)); | |
scan.AddAllTypesOf(typeof(IPostRequestHandler<,>)); | |
scan.WithDefaultConventions(); | |
}); | |
//For<IExample>().Use<Example>(); | |
// Setup the classes for our mediators (not needed due to convention) | |
// | |
//For<IMediator>().Use<Mediator>(); | |
// Add our mediator pipeline as a decorator for all mediator requests | |
// | |
For(typeof(IRequestHandler<,>)).DecorateAllWith(typeof(MediatorPipeline<,>)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment