internal TransactionContext(DataAccessTransaction dataAccessTransaction, DataAccessModel dataAccessModel) { this.dataAccessModel = dataAccessModel; this.DataAccessTransaction = dataAccessTransaction; this.DatabaseContextCategoriesKey = "*"; this.attributes = new Dictionary <string, object>(); this.executionVersion = dataAccessModel.AsyncLocalExecutionVersion; }
internal TransactionContext(DataAccessTransaction dataAccessTransaction, DataAccessModel dataAccessModel) { this.dataAccessModel = dataAccessModel; this.DataAccessTransaction = dataAccessTransaction; this.DatabaseContextCategoriesKey = "*"; this.executionVersion = dataAccessModel.AsyncLocalExecutionVersion; this.commandsContextsBySqlDatabaseContexts = new ConcurrentDictionary <SqlDatabaseContext, SqlTransactionalCommandsContext>(); }
public DataAccessScope(DataAccessIsolationLevel isolationLevel, DataAccessScopeOptions options, TimeSpan timeout) { this.IsolationLevel = isolationLevel; var currentTransaction = DataAccessTransaction.Current; this.options = options; switch (options) { case DataAccessScopeOptions.Required: if (currentTransaction == null) { this.isRoot = true; this.transaction = new DataAccessTransaction(isolationLevel, timeout); DataAccessTransaction.Current = this.transaction; } else { this.transaction = currentTransaction; this.outerTransaction = currentTransaction; } break; case DataAccessScopeOptions.RequiresNew: this.isRoot = true; this.outerTransaction = currentTransaction; if (Transaction.Current != null) { this.nativeScope = new TransactionScope(TransactionScopeOption.RequiresNew); } this.transaction = new DataAccessTransaction(isolationLevel, timeout); DataAccessTransaction.Current = this.transaction; break; case DataAccessScopeOptions.Suppress: if (Transaction.Current != null) { this.nativeScope = new TransactionScope(TransactionScopeOption.Suppress); } if (currentTransaction != null) { this.outerTransaction = currentTransaction; DataAccessTransaction.Current = null; } break; } }
internal DataAccessTransaction(DataAccessIsolationLevel isolationLevel, TimeSpan timeout) { this.timeout = timeout; this.IsolationLevel = isolationLevel; this.SystemTransaction = Transaction.Current; if (this.SystemTransaction != null) { this.previousTransaction = Current; this.SystemTransaction.TransactionCompleted += (sender, eventArgs) => { this.systemTransactionCompleted = true; this.systemTransactionStatus = eventArgs.Transaction.TransactionInformation.Status; this.Dispose(); }; } }
internal DataAccessTransaction(DataAccessIsolationLevel isolationLevel, TimeSpan timeout) { this.timeout = timeout; this.IsolationLevel = isolationLevel; this.SystemTransaction = Transaction.Current; if (this.SystemTransaction != null) { this.previousTransaction = Current; this.SystemTransaction.TransactionCompleted += (sender, eventArgs) => { this.systemTransactionCompleted = true; this.systemTransactionStatus = eventArgs.Transaction.TransactionInformation.Status; Dispose(); }; } this.DataAccessTransactionId = this.SystemTransaction?.TransactionInformation.LocalIdentifier ?? Guid.NewGuid().ToString("N"); }