本文整理汇总了C#中System.Data.OleDb.OleDbTransaction.BeginInternal方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbTransaction.BeginInternal方法的具体用法?C# OleDbTransaction.BeginInternal怎么用?C# OleDbTransaction.BeginInternal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbTransaction
的用法示例。
在下文中一共展示了OleDbTransaction.BeginInternal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Begin
public OleDbTransaction Begin(System.Data.IsolationLevel isolevel)
{
OleDbTransaction transaction2;
IntPtr ptr;
OleDbConnection.ExecutePermission.Demand();
Bid.ScopeEnter(out ptr, "<oledb.OleDbTransaction.Begin|API> %d#, isolevel=%d{IsolationLevel}", this.ObjectID, (int) isolevel);
try
{
if (this._transaction == null)
{
throw ADP.TransactionZombied(this);
}
if ((this._nestedTransaction != null) && this._nestedTransaction.IsAlive)
{
throw ADP.ParallelTransactionsNotSupported(this.Connection);
}
OleDbTransaction target = new OleDbTransaction(this._parentConnection, this, isolevel);
this._nestedTransaction = new WeakReference(target, false);
UnsafeNativeMethods.ITransactionLocal transaction = null;
try
{
transaction = (UnsafeNativeMethods.ITransactionLocal) this._transaction.ComWrapper();
target.BeginInternal(transaction);
}
finally
{
if (transaction != null)
{
Marshal.ReleaseComObject(transaction);
}
}
transaction2 = target;
}
finally
{
Bid.ScopeLeave(ref ptr);
}
return transaction2;
}
示例2: Begin
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);
}
}
示例3: BeginTransaction
override public DbTransaction BeginTransaction(IsolationLevel isolationLevel) {
OleDbConnection.ExecutePermission.Demand();
OleDbConnection outerConnection = Connection;
if (null != LocalTransaction) {
throw ADP.ParallelTransactionsNotSupported(outerConnection);
}
object unknown = null;
OleDbTransaction transaction;
try {
transaction = new OleDbTransaction(outerConnection, null, isolationLevel);
Bid.Trace("<oledb.IUnknown.QueryInterface|API|OLEDB|session> %d#, ITransactionLocal\n", ObjectID);
Debug.Assert(null != _datasrcwrp, "ITransactionLocal: null datasource");
Debug.Assert(null != _sessionwrp, "ITransactionLocal: null session");
unknown = _sessionwrp.ComWrapper();
UnsafeNativeMethods.ITransactionLocal value = (unknown as UnsafeNativeMethods.ITransactionLocal);
if (null == value) {
throw ODB.TransactionsNotSupported(Provider, (Exception)null);
}
transaction.BeginInternal(value);
}
finally {
if (null != unknown) {
Marshal.ReleaseComObject(unknown);
}
}
LocalTransaction = transaction;
return transaction;
}