public GeneralLedgerModule(EventStoreClient eventStore, IMessageTypeMapper messageTypeMapper, JsonSerializerOptions serializerOptions) { Build <OpenGeneralLedger>() .Log() .UnitOfWork(eventStore, messageTypeMapper, serializerOptions) .Handle((_, ct) => { var(unitOfWork, command) = _; var handlers = new GeneralLedgerHandlers( new GeneralLedgerEventStoreRepository(eventStore, messageTypeMapper, unitOfWork), new GeneralLedgerEntryEventStoreRepository(eventStore, messageTypeMapper, unitOfWork), new ChartOfAccountsEventStoreRepository(eventStore, messageTypeMapper, unitOfWork)); return(handlers.Handle(command, ct)); }); Build <BeginClosingAccountingPeriod>() .Log() .UnitOfWork(eventStore, messageTypeMapper, serializerOptions) .Handle((_, ct) => { var(unitOfWork, command) = _; var handlers = new GeneralLedgerHandlers( new GeneralLedgerEventStoreRepository(eventStore, messageTypeMapper, unitOfWork), new GeneralLedgerEntryEventStoreRepository(eventStore, messageTypeMapper, unitOfWork), new ChartOfAccountsEventStoreRepository(eventStore, messageTypeMapper, unitOfWork)); return(handlers.Handle(command, ct)); }); }
public GeneralLedgerModule(EventStoreClient eventStore, IMessageTypeMapper messageTypeMapper) { var handlers = new GeneralLedgerHandlers( new GeneralLedgerEventStoreRepository(eventStore, messageTypeMapper), new ChartOfAccountsEventStoreRepository(eventStore, messageTypeMapper)); Build <OpenGeneralLedger>() .Log() .UnitOfWork(eventStore, messageTypeMapper) .Handle(async(command, ct) => { await handlers.Handle(command, ct); return(Checkpoint.None); }); Build <BeginClosingAccountingPeriod>() .Log() .UnitOfWork(eventStore, messageTypeMapper) .Handle(async(command, ct) => { await handlers.Handle(command, ct); return(Checkpoint.None); }); }