Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="handlerType"></param>
 /// <param name="activationType"></param>
 /// <returns></returns>
 public static EventHandlerDescriptor Describe(Type handlerType, EventHandlerActivationType activationType)
 {
     if (!handlerType.IsAssignableTo <IEventHandler>())
     {
         throw new ArgumentException($"{nameof(handlerType)} should be derived from {typeof(IEventHandler)}", nameof(handlerType));
     }
     return(new EventHandlerDescriptor(handlerType, activationType));
 }
Esempio n. 2
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);
 }
Esempio n. 3
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);
 }
Esempio n. 4
0
 public ActivationTypeSelector(EventHandlerActivationType activationType)
 {
     _activationType = activationType;
 }
Esempio n. 5
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="TEventHandler"></typeparam>
 /// <param name="activationType"></param>
 /// <returns></returns>
 public static EventHandlerDescriptor Describe <TEventHandler>(EventHandlerActivationType activationType) where TEventHandler : class, IEventHandler
 {
     return(Describe(typeof(TEventHandler), activationType));
 }
Esempio n. 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="activationType"></param>
 /// <param name="handlerType"></param>
 public EventHandlerDescriptor(Type handlerType, EventHandlerActivationType activationType)
 {
     ActivationType = activationType;
     HandlerType    = handlerType;
 }
Esempio n. 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="activationType"></param>
 /// <returns></returns>
 public static IConventionalContext ActivationByType(this IConventionalContext context, EventHandlerActivationType activationType)
 {
     context.Set("HandlerActivationTypeSelector", new ActivationTypeSelector(activationType));
     return(context);
 }