public OleDbTransaction Begin(IsolationLevel isolevel) { if (null == _transaction) { throw ADP.TransactionZombied(this); } else if ((null != _nestedTransaction) && _nestedTransaction.IsAlive) { throw ADP.ParallelTransactionsNotSupported(Connection); } // either the connection will be open or this will be a zombie OleDbTransaction transaction = new OleDbTransaction(_parentConnection, this, isolevel); _nestedTransaction = new WeakReference(transaction, false); UnsafeNativeMethods.ITransactionLocal wrapper = null; try { wrapper = (UnsafeNativeMethods.ITransactionLocal)_transaction.ComWrapper(); transaction.BeginInternal(wrapper); } finally { if (null != wrapper) { Marshal.ReleaseComObject(wrapper); } } return(transaction); }
public OleDbTransaction Begin(IsolationLevel isolevel) { OleDbConnection.ExecutePermission.Demand(); // MDAC 81476 IntPtr hscp; Bid.ScopeEnter(out hscp, "<oledb.OleDbTransaction.Begin|API> %d#, isolevel=%d{IsolationLevel}", ObjectID, (int)isolevel); try { if (null == _transaction) { throw ADP.TransactionZombied(this); } else if ((null != _nestedTransaction) && _nestedTransaction.IsAlive) { throw ADP.ParallelTransactionsNotSupported(Connection); } // either the connection will be open or this will be a zombie OleDbTransaction transaction = new OleDbTransaction(_parentConnection, this, isolevel); _nestedTransaction = new WeakReference(transaction, false); UnsafeNativeMethods.ITransactionLocal wrapper = null; try { wrapper = (UnsafeNativeMethods.ITransactionLocal)_transaction.ComWrapper(); transaction.BeginInternal(wrapper); } finally { if (null != wrapper) { Marshal.ReleaseComObject(wrapper); } } return(transaction); } finally { Bid.ScopeLeave(ref hscp); } }