/// <inheritdoc /> public void UseTransaction(DbTransaction transaction) { var efTransaction = Database.UseTransaction(transaction); var curiosityTransaction = new CuriosityDbTransaction(efTransaction); _transaction = curiosityTransaction; _transaction.OnTransactionCompleted += () => OnTransactionCompleted?.Invoke(); }
/// <inheritdoc /> public async Task <ICuriosityDataContextTransaction> BeginTransactionAsync(IsolationLevel isolationLevel = IsolationLevel.ReadCommitted, CancellationToken cancellationToken = default) { var transaction = await base.Database.BeginTransactionAsync(isolationLevel, cancellationToken); var curiosityTransaction = new CuriosityDbTransaction(transaction); _transaction = curiosityTransaction; _transaction.OnTransactionCompleted += () => OnTransactionCompleted?.Invoke(); _transaction.OnTransactionCompletedAsync += ct => OnTransactionCompletedAsync != null ? OnTransactionCompletedAsync.Invoke(ct) : Task.CompletedTask; return(curiosityTransaction); }
/// <inheritdoc /> public ICuriosityDataContextTransaction BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.ReadCommitted) { var transaction = base.Database.BeginTransaction(isolationLevel); var curiosityTransaction = new CuriosityDbTransaction(transaction); _transaction = curiosityTransaction; _transaction.OnTransactionCompleted += () => OnTransactionCompleted?.Invoke(); _transaction.OnTransactionCompletedAsync += ct => OnTransactionCompletedAsync != null ? OnTransactionCompletedAsync.Invoke(ct) : Task.CompletedTask; return(curiosityTransaction); }