/// <summary>Parameterized constructor. /// </summary> /// <param name="waitingCommandService"></param> /// <param name="aggregateRootTypeCodeProvider"></param> /// <param name="aggregateRootFactory"></param> /// <param name="eventStreamConvertService"></param> /// <param name="eventSourcingService"></param> /// <param name="memoryCache"></param> /// <param name="aggregateStorage"></param> /// <param name="retryCommandService"></param> /// <param name="eventStore"></param> /// <param name="eventPublisher"></param> /// <param name="actionExecutionService"></param> /// <param name="eventSynchronizerProvider"></param> /// <param name="loggerFactory"></param> public DefaultCommitEventService( IWaitingCommandService waitingCommandService, IAggregateRootTypeCodeProvider aggregateRootTypeCodeProvider, IAggregateRootFactory aggregateRootFactory, IEventStreamConvertService eventStreamConvertService, IEventSourcingService eventSourcingService, IMemoryCache memoryCache, IAggregateStorage aggregateStorage, IRetryCommandService retryCommandService, IEventStore eventStore, IEventPublisher eventPublisher, IActionExecutionService actionExecutionService, IEventSynchronizerProvider eventSynchronizerProvider, ILoggerFactory loggerFactory) { _waitingCommandService = waitingCommandService; _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider; _aggregateRootFactory = aggregateRootFactory; _eventStreamConvertService = eventStreamConvertService; _eventSourcingService = eventSourcingService; _memoryCache = memoryCache; _aggregateStorage = aggregateStorage; _retryCommandService = retryCommandService; _eventStore = eventStore; _eventPublisher = eventPublisher; _actionExecutionService = actionExecutionService; _eventSynchronizerProvider = eventSynchronizerProvider; _logger = loggerFactory.Create(GetType().Name); }
public async Task Post([FromServices] IEventSourcingService eventSourcingService, [FromServices] EventSourcingDbContext dbContext, [FromBody] string value, CancellationToken cancellationToken) { using (var transaction = await dbContext.Database.BeginTransactionAsync(cancellationToken)) { await eventSourcingService.SaveEventLogAsync(new MessageTest(Guid.NewGuid().ToString()) { Testando = value }, transaction); transaction.Commit(); } //eventBus.Publish<MessageTest>(new MessageTest(Guid.NewGuid().ToString()) { Testando = value }); }
/// <summary>Parameterized constructor. /// </summary> /// <param name="aggregateRootFactory"></param> /// <param name="eventStreamConvertService"></param> /// <param name="eventSourcingService"></param> /// <param name="eventStore"></param> /// <param name="snapshotStore"></param> /// <param name="aggregateRootTypeCodeProvider"></param> public EventSourcingAggregateStorage( IAggregateRootFactory aggregateRootFactory, IEventStreamConvertService eventStreamConvertService, IEventSourcingService eventSourcingService, IEventStore eventStore, ISnapshotStore snapshotStore, IAggregateRootTypeCodeProvider aggregateRootTypeCodeProvider) { _aggregateRootFactory = aggregateRootFactory; _eventStreamConvertService = eventStreamConvertService; _eventSourcingService = eventSourcingService; _eventStore = eventStore; _snapshotStore = snapshotStore; _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider; }