internal DataAccessTransaction(DataAccessIsolationLevel isolationLevel, DataAccessScope scope, TimeSpan timeout) { this.timeout = timeout; this.scope = scope; this.IsolationLevel = isolationLevel; this.SystemTransaction = Transaction.Current; }
public static IsolationLevel ConvertIsolationLevel(DataAccessIsolationLevel isolationLevel) { switch (isolationLevel) { case DataAccessIsolationLevel.ReadUncommitted: return(IsolationLevel.ReadUncommitted); case DataAccessIsolationLevel.Serializable: return(IsolationLevel.Serializable); case DataAccessIsolationLevel.ReadCommitted: return(IsolationLevel.ReadCommitted); case DataAccessIsolationLevel.Chaos: return(IsolationLevel.Chaos); case DataAccessIsolationLevel.RepeatableRead: return(IsolationLevel.RepeatableRead); case DataAccessIsolationLevel.Snapshot: return(IsolationLevel.Snapshot); default: return(IsolationLevel.Unspecified); } }
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(); }; } }
public static IsolationLevel ConvertIsolationLevel(DataAccessIsolationLevel isolationLevel) { switch (isolationLevel) { case DataAccessIsolationLevel.ReadUncommitted: return IsolationLevel.ReadUncommitted; case DataAccessIsolationLevel.Serializable: return IsolationLevel.Serializable; case DataAccessIsolationLevel.ReadCommitted: return IsolationLevel.ReadCommitted; case DataAccessIsolationLevel.Chaos: return IsolationLevel.Chaos; case DataAccessIsolationLevel.RepeatableRead: return IsolationLevel.RepeatableRead; case DataAccessIsolationLevel.Snapshot: return IsolationLevel.Snapshot; default: return IsolationLevel.Unspecified; } }
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"); }
internal DataAccessTransaction(DataAccessIsolationLevel isolationLevel) : this(isolationLevel, TimeSpan.Zero) { }
public DataAccessScope(DataAccessIsolationLevel isolationLevel, TimeSpan timeout) : this(isolationLevel, DataAccessScopeOptions.Required, timeout) { }
public DataAccessScope(DataAccessIsolationLevel isolationLevel) : this(isolationLevel, TimeSpan.Zero) { }
internal DataAccessTransaction(DataAccessIsolationLevel isolationLevel) { this.IsolationLevel = isolationLevel; this.SystemTransaction = Transaction.Current; }