internal WrappedTransaction(UnsafeNativeMethods.ITransactionLocal transaction, int isolevel, out OleDbHResult hr) : base(transaction) { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { hr = transaction.StartTransaction(isolevel, 0, IntPtr.Zero, out _); if (0 <= hr) { _mustComplete = true; } } }
internal WrappedTransaction(UnsafeNativeMethods.ITransactionLocal transaction, int isolevel, out OleDbHResult hr) : base(transaction) { int transactionLevel = 0; Bid.Trace("<oledb.ITransactionLocal.StartTransaction|API|OLEDB>\n"); RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { hr = transaction.StartTransaction(isolevel, 0, IntPtr.Zero, out transactionLevel); if (0 <= hr) { _mustComplete = true; } } Bid.Trace("<oledb.ITransactionLocal.StartTransaction|API|OLEDB|RET> %08X{HRESULT}\n", hr); }
internal void BeginInternal(UnsafeNativeMethods.ITransactionLocal transaction, IsolationLevel isolevel) { switch (isolevel) { case IsolationLevel.Unspecified: case IsolationLevel.Chaos: case IsolationLevel.ReadUncommitted: case IsolationLevel.ReadCommitted: case IsolationLevel.RepeatableRead: case IsolationLevel.Serializable: break; default: throw ADP.InvalidIsolationLevel((int)isolationLevel); } int hr, transactionLevel = 0; #if DEBUG if (AdapterSwitches.OleDbTrace.TraceInfo) { ODB.Trace_Begin("ITransactionLocal", "StartTransaction", this.isolationLevel.ToString("G")); } #endif // $UNDONE: how is it possible to guard against something like ThreadAbortException // when transaction started, but aborted before localTransaction is set // so we know to rollback the transaction for when connection is returned to the pool hr = transaction.StartTransaction((int)isolevel, 0, null, out transactionLevel); #if DEBUG if (AdapterSwitches.OleDbTrace.TraceInfo) { ODB.Trace_End("ITransactionLocal", "StartTransaction", hr, "TransactionLevel=" + transactionLevel); } #endif if (hr < 0) { ProcessResults(hr); } this.isolationLevel = isolevel; this.localTransaction = transaction; this.iunknown = Marshal.GetIUnknownForObject(transaction); GC.KeepAlive(this); }