예제 #1
0
        public ChartOfAccountsModule(EventStoreClient eventStore, IMessageTypeMapper messageTypeMapper,
                                     JsonSerializerOptions serializerOptions)
        {
            Build <DefineAccount>()
            .Log()
            .UnitOfWork(eventStore, messageTypeMapper, serializerOptions)
            .Handle(async(_, ct) => {
                var(unitOfWork, command) = _;
                var handlers             = new ChartOfAccountsHandlers(
                    new ChartOfAccountsEventStoreRepository(eventStore, messageTypeMapper, unitOfWork));

                await handlers.Handle(command, ct);

                return(Position.Start);
            });

            Build <DeactivateAccount>()
            .Log()
            .UnitOfWork(eventStore, messageTypeMapper, serializerOptions)
            .Handle(async(_, ct) => {
                var(unitOfWork, command) = _;
                var handlers             = new ChartOfAccountsHandlers(
                    new ChartOfAccountsEventStoreRepository(eventStore, messageTypeMapper, unitOfWork));

                await handlers.Handle(command, ct);

                return(Position.Start);
            });

            Build <ReactivateAccount>()
            .Log()
            .UnitOfWork(eventStore, messageTypeMapper, serializerOptions)
            .Handle(async(_, ct) => {
                var(unitOfWork, command) = _;
                var handlers             = new ChartOfAccountsHandlers(
                    new ChartOfAccountsEventStoreRepository(eventStore, messageTypeMapper, unitOfWork));

                await handlers.Handle(command, ct);

                return(Position.Start);
            });

            Build <RenameAccount>()
            .Log()
            .UnitOfWork(eventStore, messageTypeMapper, serializerOptions)
            .Handle(async(_, ct) => {
                var(unitOfWork, command) = _;
                var handlers             = new ChartOfAccountsHandlers(
                    new ChartOfAccountsEventStoreRepository(eventStore, messageTypeMapper, unitOfWork));

                await handlers.Handle(command, ct);

                return(Position.Start);
            });
        }
예제 #2
0
        public ChartOfAccountsModule(EventStoreClient eventStore, IMessageTypeMapper messageTypeMapper)
        {
            var handlers =
                new ChartOfAccountsHandlers(new ChartOfAccountsEventStoreRepository(eventStore, messageTypeMapper));

            Build <DefineAccount>()
            .Log()
            .UnitOfWork(eventStore, messageTypeMapper)
            .Handle(async(command, ct) => {
                await handlers.Handle(command, ct);

                return(Checkpoint.None);
            });

            Build <DeactivateAccount>()
            .Log()
            .UnitOfWork(eventStore, messageTypeMapper)
            .Handle(async(command, ct) => {
                await handlers.Handle(command, ct);

                return(Checkpoint.None);
            });

            Build <ReactivateAccount>()
            .Log()
            .UnitOfWork(eventStore, messageTypeMapper)
            .Handle(async(command, ct) => {
                await handlers.Handle(command, ct);

                return(Checkpoint.None);
            });

            Build <RenameAccount>()
            .Log()
            .UnitOfWork(eventStore, messageTypeMapper)
            .Handle(async(command, ct) => {
                await handlers.Handle(command, ct);

                return(Checkpoint.None);
            });
        }