public LevantamentoIntegrationEventService( LevantamentoContext levantamentoContext, Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory, IEventBus eventBus) { _levantamentoContext = levantamentoContext; _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory)); _eventLogService = _integrationEventLogServiceFactory(_levantamentoContext.Database.GetDbConnection()); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); }
public static async Task DispatchDomainEventsAsync(this IMediator mediator, LevantamentoContext ctx) { var domainEntities = ctx.ChangeTracker .Entries <Entity>() .Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any()); var domainEvents = domainEntities .SelectMany(x => x.Entity.DomainEvents) .ToList(); domainEntities.ToList() .ForEach(entity => entity.Entity.ClearDomainEvents()); var tasks = domainEvents .Select(async(domainEvent) => { await mediator.Publish(domainEvent); }); await Task.WhenAll(tasks); }
public LevantamentoRepository(LevantamentoContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public TransactionBehaviourNoSql(ILevantamentoIntegrationEventService levantamentoIntegrationEventService, LevantamentoContext context) { _levantamentoIntegrationEventService = levantamentoIntegrationEventService ?? throw new ArgumentException(nameof(levantamentoIntegrationEventService)); _context = context ?? throw new ArgumentException(nameof(context)); }
public UnitOfWork(LevantamentoContext context) { _context = context; }
public LevantamentoRepository(LevantamentoContext context) { _context = context; db = _context.GetCollection <Domain.AggregatesModel.LevantamentoAggregate.Levantamentos>("Levantamento"); }