public Task SaveEventAsync(IntegrationEvent @event, IDbContextTransaction transaction) { if (transaction == null) { throw new ArgumentNullException(nameof(transaction)); } var eventLogEntry = new IntegrationEventLogEntry(@event, transaction.TransactionId); _integrationEventLogContext.Database.UseTransaction(transaction.GetDbTransaction()); _integrationEventLogContext.IntegrationEventLogs.Add(eventLogEntry); return(_integrationEventLogContext.SaveChangesAsync()); }
//Değişikliğin yapıldığı asıl connection la aynı transaction ı kullanıyor. public Task SaveEventAsync(IntegrationEvent @event, IDbContextTransaction transaction) { _logger.LogInformation(" [x] IntegrationEventLogService.SaveEventAsync(): Saving event {0} with transaction {1}...", @event.Id, transaction.TransactionId); if (transaction == null) { throw new ArgumentNullException(nameof(transaction)); } var eventLogEntry = new IntegrationEventLogEntry(@event, transaction.TransactionId); _integrationEventLogContext.Database.UseTransaction(transaction.GetDbTransaction()); _integrationEventLogContext.IntegrationEventLogs.Add(eventLogEntry); return(_integrationEventLogContext.SaveChangesAsync()); }