예제 #1
0
        public static IEventFlowOptions AddCommandHandlers(
            this IEventFlowOptions eventFlowOptions,
            Assembly fromAssembly,
            Predicate <Type> predicate = null)
        {
            predicate = predicate ?? (t => true);
            var commandHandlerTypes = fromAssembly
                                      .GetTypes()
                                      .Where(t => t.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(ICommandHandler <, , ,>)))
                                      .Where(t => predicate(t));

            return(eventFlowOptions.AddCommandHandlers(commandHandlerTypes));
        }
        public static IEventFlowOptions AddCommandHandlers(
            this IEventFlowOptions eventFlowOptions,
            Assembly fromAssembly,
            Predicate <Type> predicate = null)
        {
            predicate = predicate ?? (t => true);
            var commandHandlerTypes = fromAssembly
                                      .GetTypes()
                                      .Where(t => t.GetTypeInfo().GetInterfaces().Any(IsCommandHandlerInterface))
                                      .Where(t => !t.HasConstructorParameterOfType(IsCommandHandlerInterface))
                                      .Where(t => predicate(t));

            return(eventFlowOptions.AddCommandHandlers(commandHandlerTypes));
        }
예제 #3
0
 public static IEventFlowOptions AddCommandHandlers(
     this IEventFlowOptions eventFlowOptions,
     params Type[] commandHandlerTypes)
 {
     return(eventFlowOptions.AddCommandHandlers((IEnumerable <Type>)commandHandlerTypes));
 }
예제 #4
0
 private void RegisterCommandHandlers(IEventFlowOptions eventFlowOptions)
 {
     eventFlowOptions.AddCommandHandlers(typeof(CreateTestHandler));
 }