static void ConfigureMessageHandlersIn(FeatureConfigurationContext context, IEnumerable<Type> types) { var handlerRegistry = new MessageHandlerRegistry(context.Settings.Get<Conventions>()); var handlers = new List<Type>(); foreach (var t in types.Where(IsMessageHandler)) { context.Container.ConfigureComponent(t, DependencyLifecycle.InstancePerUnitOfWork); handlerRegistry.RegisterHandler(t); handlers.Add(t); } List<Action<IConfigureComponents>> propertiesToInject; if (context.Settings.TryGet("NServiceBus.HandlerProperties", out propertiesToInject)) { foreach (var action in propertiesToInject) { action(context.Container); } } context.Container.RegisterSingleton<IMessageHandlerRegistry>(handlerRegistry); }
static void ConfigureMessageHandlersIn(FeatureConfigurationContext context, IEnumerable<Type> types) { var handlerRegistry = new MessageHandlerRegistry(context.Settings.Get<Conventions>()); var handlers = new List<Type>(); foreach (var t in types.Where(IsMessageHandler)) { context.Container.ConfigureComponent(t, DependencyLifecycle.InstancePerUnitOfWork); handlerRegistry.RegisterHandler(t); handlers.Add(t); } context.Container.RegisterSingleton<IMessageHandlerRegistry>(handlerRegistry); }