Example #1
0
        public static IEventFlowOptions AddCommandsAndCommandHandlers(this IEventFlowOptions options)
        {
            var assambly = typeof(DependencyInjection).Assembly;

            options.AddCommands(assambly)
            .AddCommandHandlers(assambly);
            return(options);
        }
 protected override IRootResolver CreateRootResolver(IEventFlowOptions eventFlowOptions)
 {
     return(eventFlowOptions
            .AddCommands(new [] { typeof(CommandA), typeof(CommandA) })
            .AddCommandHandlers(typeof(CommandHandlerA), typeof(CommandHandlerB))
            .AddEvents(typeof(EventA), typeof(EventB))
            .UseInMemoryReadStoreFor <ReadModelAB, ReadModelLocatorAB>()
            .RegisterServices(sr => sr.RegisterType(typeof(ReadModelLocatorAB)))
            .CreateResolver());
 }
 protected override IServiceProvider Configure(IEventFlowOptions eventFlowOptions)
 {
     return(eventFlowOptions
            .AddCommands(new [] { typeof(CommandA), typeof(CommandA) })
            .AddCommandHandlers(typeof(CommandHandlerA), typeof(CommandHandlerB))
            .AddEvents(typeof(EventA), typeof(EventB))
            .UseInMemoryReadStoreFor <ReadModelAB, ReadModelLocatorAB>()
            .RegisterServices(sr => sr.AddTransient(typeof(ReadModelLocatorAB)))
            .ServiceCollection.BuildServiceProvider());
 }
Example #4
0
        public static IEventFlowOptions AddCommands(
            this IEventFlowOptions eventFlowOptions,
            Assembly fromAssembly,
            Predicate <Type> predicate)
        {
            predicate = predicate ?? (t => true);
            var commandTypes = fromAssembly
                               .GetTypes()
                               .Where(t => !t.IsAbstract && typeof(ICommand).IsAssignableFrom(t))
                               .Where(t => predicate(t));

            return(eventFlowOptions.AddCommands(commandTypes));
        }
Example #5
0
 public static IEventFlowOptions AddCommands(
     this IEventFlowOptions eventFlowOptions,
     params Type[] commandTypes)
 {
     return(eventFlowOptions.AddCommands(commandTypes));
 }
Example #6
0
 private void RegisterCommands(IEventFlowOptions eventFlowOptions)
 {
     eventFlowOptions.AddCommands(typeof(CreateTest));
 }