コード例 #1
0
        public static InMemoryCommandBus CreateConventionCommandBus(IDomainObjectRepository repository,
                                                                    params Assembly[] domainObjectAssemblies)
        {
            Precondition.For(repository, nameof(repository)).NotNull();

            var invoker = new ConventionCommandInvoker(repository);
            var handler = new ConventionCommandPipeline(invoker, new DomainObjectLocator(), domainObjectAssemblies);
            var bus     = new InMemoryCommandBus(handler);

            return(bus);
        }
コード例 #2
0
        public static InMemoryCommandBus CreateConventionCommandBus(IDomainObjectRepository repository,
                                                                    ILoggerFactory loggerFactory,
                                                                    EventSourceConfiguration configuration)
        {
            Precondition.For(repository, nameof(repository)).NotNull();
            Precondition.For(loggerFactory, nameof(loggerFactory)).NotNull();
            Precondition.For(configuration, nameof(configuration)).NotNull();

            var logger = loggerFactory.CreateLogger <InMemoryCommandBus>();

            logger.LogInformation("Building InMemory CommandBus with convention based pipeline");

            var invoker = new ConventionCommandInvoker(repository, loggerFactory);
            var handler = new ConventionCommandPipeline(invoker, new DomainObjectLocator(), loggerFactory,
                                                        configuration.DomainObjectAssemblies);

            var bus = new InMemoryCommandBus(handler, loggerFactory);

            return(bus);
        }