public DefaultEventHandlerFactory(IEventHandlerActivator activator) { if (activator == null) { throw new ArgumentNullException(nameof(activator)); } EventHandlerActivator = activator; }
/// <summary> /// Initializes a new instance of the <see cref="EventHandlerDescriptor"/> class. /// </summary> /// <param name="configuration">The <see cref="ProcessorConfiguration"/>.</param> /// <param name="eventType">The type of the message.</param> /// <param name="handlerType">The type of the handler.</param> /// <param name="handleMethod">The <see cref="MethodInfo"/> of the "Handle" method.</param> public EventHandlerDescriptor(ProcessorConfiguration configuration, Type eventType, Type handlerType, MethodInfo handleMethod) : base(configuration, eventType, handlerType) { this.AddAttributesToCache(handleMethod.GetCustomAttributes(true)); this.actionExecutor = new Lazy <ActionExecutor>(() => InitializeActionExecutor(handleMethod, eventType)); this.handlerActivator = this.Configuration.Services.GetEventHandlerActivator(); this.Initialize(); }
private static void CreateEventHandlerActivatorTracer(ProcessorConfiguration configuration, ITraceWriter traceWriter) { Contract.Requires(configuration != null); IEventHandlerActivator activator = GetService <IEventHandlerActivator>(configuration.Services); if (activator != null && !(activator is EventHandlerActivatorTracer)) { EventHandlerActivatorTracer tracer = new EventHandlerActivatorTracer(activator, traceWriter); configuration.Services.Replace(typeof(IEventHandlerActivator), tracer); } }
public DefaultEventHandlerFactory() { EventHandlerActivator = new DefaultEventHandlerActivator(); }