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()); }
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)); }
public static IEventFlowOptions AddCommands( this IEventFlowOptions eventFlowOptions, params Type[] commandTypes) { return(eventFlowOptions.AddCommands(commandTypes)); }
private void RegisterCommands(IEventFlowOptions eventFlowOptions) { eventFlowOptions.AddCommands(typeof(CreateTest)); }