Beispiel #1
0
        // NOTE: This is just a private helper because OracleClient V1.1 shipped
        // with a different argument name and it's a breaking change to not use
        // the same argument names in V2.0 (VB Named Parameter Binding--Ick)
        private void EnlistDistributedTransactionHelper(System.EnterpriseServices.ITransaction transaction)
        {
            System.Security.PermissionSet permissionSet = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.None);
            permissionSet.AddPermission(SqlConnection.ExecutePermission); // MDAC 81476
            permissionSet.AddPermission(new System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode));
            permissionSet.Demand();

            SqlClientEventSource.Log.TryTraceEvent("<prov.DbConnectionHelper.EnlistDistributedTransactionHelper|RES|TRAN> {0}, Connection enlisting in a transaction.", ObjectID);
            SysTx.Transaction indigoTransaction = null;

            if (null != transaction)
            {
                indigoTransaction = SysTx.TransactionInterop.GetTransactionFromDtcTransaction((SysTx.IDtcTransaction)transaction);
            }

            RepairInnerConnection();
            // NOTE: since transaction enlistment involves round trips to the
            // server, we don't want to lock here, we'll handle the race conditions
            // elsewhere.
            InnerConnection.EnlistTransaction(indigoTransaction);

            // NOTE: If this outer connection were to be GC'd while we're
            // enlisting, the pooler would attempt to reclaim the inner connection
            // while we're attempting to enlist; not sure how likely that is but
            // we should consider a GC.KeepAlive(this) here.
            GC.KeepAlive(this);
        }
Beispiel #2
0
		}  // Dispose


		/*
		** Name: EnlistDistributedTransaction
		**
		** History:
		**	25-Sep-03 (thoda04)
		**	    Created.
		*/

		/// <summary>
		/// Enlist the connection into a distributed transaction.
		/// </summary>
		/// <param name="transaction">
		/// A transaction object based on the ITransaction interface.</param>
		public void EnlistDistributedTransaction(
			System.EnterpriseServices.ITransaction transaction)
		{
			if (transaction == null)
				throw new IngresException(
					"The transaction is null.");

			EnlistDistributedTransaction(transaction, true);
		}
Beispiel #3
0
		/// <summary>
		/// Enlist the connection into the distributed transaction.
		/// </summary>
		/// <param name="transaction"></param>
		/// <param name="isExplicitTransaction">User transaction if true;
		/// implicit Contextutil.Transaction or System.Transactions if false.</param>
		private void EnlistDistributedTransaction(
			System.EnterpriseServices.ITransaction transaction,
			bool                                   isExplicitTransaction)
		{
			// Check that a BeginTransaction has not already been issued.
			if (Transaction != null)
				if (Transaction.HasAlreadyBeenCommittedOrRolledBack)
					Transaction = null;
				else
					throw new InvalidOperationException(
						"The connection has already begun a transaction " +
						"using BeginTransaction.");

			// The connection must be open before 
			// calling EnlistDistributedTransaction.
			if (State != ConnectionState.Open)
				throw new InvalidOperationException(
					"The connection must be open before " +
					"calling EnlistDistributedTransaction.");

			try
			{
				// If an old DTCEnlistment exists then make sure its closed
				if (this.DTCenlistment != null)
				{
					this.DTCenlistment.Delist();
					this.DTCenlistment = null;
				}

				advanConnect.setAutoCommit(false);   // turn autocommit off

				DTCEnlistment DTCenlistment = new DTCEnlistment();
				DTCenlistment.Enlist(
					this.advanConnect, transaction, config);

				this.DTCenlistment = DTCenlistment;  // a good MSDTC enlistment in the tx
			}
			catch( SqlEx ex )
			{
				throw ex.createProviderException();
			}
		}
Beispiel #4
0
 public void EnlistDistributedTransaction(System.EnterpriseServices.ITransaction transaction)
 {
     _con.EnlistDistributedTransaction(transaction);
 }
 public void EnlistDistributedTransaction(System.EnterpriseServices.ITransaction distributedTransaction)
 {
 }
Beispiel #6
0
 public void EnlistDistributedTransaction(System.EnterpriseServices.ITransaction transaction) => throw new NotImplementedException();