Exemple #1
0
        public void AddHandler_T()
        {
            var options = new EventBusOptions();

            options.AddHandler <EmptyEventHandler>(EventHandlerActivationType.Transient);
            options.Handlers.Count.ShouldBe(1);
            options.Handlers.First().HandlerType.ShouldBe(typeof(EmptyEventHandler));
            options.Handlers.First().ActivationType.ShouldBe(EventHandlerActivationType.Transient);
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="options"></param>
 /// <typeparam name="TEventHandler"></typeparam>
 /// <returns></returns>
 public static EventBusOptions AddTransientHandler <TEventHandler>(this EventBusOptions options)
     where TEventHandler : class, IEventHandler
 {
     options.AddHandler(EventHandlerDescriptor.Transient <TEventHandler>());
     return(options);
 }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="options"></param>
 /// <typeparam name="TEventHandler"></typeparam>
 /// <returns></returns>
 public static EventBusOptions AddSingletonHandler <TEventHandler>(this EventBusOptions options)
     where TEventHandler : class, IEventHandler
 {
     options.AddHandler(EventHandlerDescriptor.Singleton <TEventHandler>());
     return(options);
 }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="options"></param>
 /// <param name="activationType"></param>
 /// <typeparam name="TEventHandler"></typeparam>
 /// <returns></returns>
 public static EventBusOptions AddHandler <TEventHandler>(this EventBusOptions options, EventHandlerActivationType activationType)
     where TEventHandler : class, IEventHandler
 {
     options.AddHandler(EventHandlerDescriptor.Describe <TEventHandler>(activationType));
     return(options);
 }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="options"></param>
 /// <param name="handlerType"></param>
 /// <param name="activationType"></param>
 /// <returns></returns>
 public static EventBusOptions AddHandler(this EventBusOptions options, Type handlerType, EventHandlerActivationType activationType)
 {
     options.AddHandler(EventHandlerDescriptor.Describe(handlerType, activationType));
     return(options);
 }