public static void InvokeTransacted(TransactedCallback callback, TransactionOption mode, ref bool transactionAborted) { HttpRuntime.CheckAspNetHostingPermission(AspNetHostingPermissionLevel.Medium, "Transaction_not_supported_in_low_trust"); bool flag = false; if ((Environment.OSVersion.Platform != PlatformID.Win32NT) || (Environment.OSVersion.Version.Major <= 4)) { throw new PlatformNotSupportedException(System.Web.SR.GetString("RequiresNT")); } if (mode == TransactionOption.Disabled) { flag = true; } if (flag) { callback(); transactionAborted = false; } else { int num; TransactedInvocation invocation = new TransactedInvocation(callback); TransactedExecCallback callback2 = new TransactedExecCallback(invocation.ExecuteTransactedCode); PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_PENDING); try { num = UnsafeNativeMethods.TransactManagedCallback(callback2, (int)mode); } finally { PerfCounters.DecrementCounter(AppPerfCounter.TRANSACTIONS_PENDING); } if (invocation.Error != null) { throw new HttpException(null, invocation.Error); } PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_TOTAL); switch (num) { case 1: PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_COMMITTED); transactionAborted = false; return; case 0: PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_ABORTED); transactionAborted = true; return; } throw new HttpException(System.Web.SR.GetString("Cannot_execute_transacted_code")); } }
public static void InvokeTransacted(TransactedCallback callback, TransactionOption mode, ref bool transactionAborted) { HttpRuntime.CheckAspNetHostingPermission(AspNetHostingPermissionLevel.Medium, "Transaction_not_supported_in_low_trust"); bool flag = false; if ((Environment.OSVersion.Platform != PlatformID.Win32NT) || (Environment.OSVersion.Version.Major <= 4)) { throw new PlatformNotSupportedException(System.Web.SR.GetString("RequiresNT")); } if (mode == TransactionOption.Disabled) { flag = true; } if (flag) { callback(); transactionAborted = false; } else { int num; TransactedInvocation invocation = new TransactedInvocation(callback); TransactedExecCallback callback2 = new TransactedExecCallback(invocation.ExecuteTransactedCode); PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_PENDING); try { num = UnsafeNativeMethods.TransactManagedCallback(callback2, (int) mode); } finally { PerfCounters.DecrementCounter(AppPerfCounter.TRANSACTIONS_PENDING); } if (invocation.Error != null) { throw new HttpException(null, invocation.Error); } PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_TOTAL); switch (num) { case 1: PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_COMMITTED); transactionAborted = false; return; case 0: PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_ABORTED); transactionAborted = true; return; } throw new HttpException(System.Web.SR.GetString("Cannot_execute_transacted_code")); } }
internal static extern int TransactManagedCallback(TransactedExecCallback callback, int mode);
/// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public static void InvokeTransacted(TransactedCallback callback, TransactionOption mode, ref bool transactionAborted) { // check for hosting permission even if no user code on the stack HttpRuntime.CheckAspNetHostingPermission(AspNetHostingPermissionLevel.Medium, SR.Transaction_not_supported_in_low_trust); bool executeWithoutTransaction = false; #if !FEATURE_PAL // FEATURE_PAL does not enable Transactions if (Environment.OSVersion.Platform != PlatformID.Win32NT || Environment.OSVersion.Version.Major <= 4) throw new PlatformNotSupportedException(SR.GetString(SR.RequiresNT)); #else // !FEATURE_PAL throw new NotImplementedException("ROTORTODO"); #endif // !FEATURE_PAL if (mode == TransactionOption.Disabled) executeWithoutTransaction = true; if (executeWithoutTransaction) { // bypass the transaction logic callback(); transactionAborted = false; return; } TransactedInvocation call = new TransactedInvocation(callback); TransactedExecCallback execCallback = new TransactedExecCallback(call.ExecuteTransactedCode); PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_PENDING); int rc; try { rc = UnsafeNativeMethods.TransactManagedCallback(execCallback, (int)mode); } finally { PerfCounters.DecrementCounter(AppPerfCounter.TRANSACTIONS_PENDING); } // rethrow the expection originally caught in managed code if (call.Error != null) throw new HttpException(null, call.Error); PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_TOTAL); if (rc == 1) { PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_COMMITTED); transactionAborted = false; } else if (rc == 0) { PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_ABORTED); transactionAborted = true; } else { throw new HttpException(SR.GetString(SR.Cannot_execute_transacted_code)); } }
/// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public static void InvokeTransacted(TransactedCallback callback, TransactionOption mode, ref bool transactionAborted) { // check for hosting permission even if no user code on the stack HttpRuntime.CheckAspNetHostingPermission(AspNetHostingPermissionLevel.Medium, SR.Transaction_not_supported_in_low_trust); bool executeWithoutTransaction = false; #if !FEATURE_PAL // FEATURE_PAL does not enable Transactions if (Environment.OSVersion.Platform != PlatformID.Win32NT || Environment.OSVersion.Version.Major <= 4) { throw new PlatformNotSupportedException(SR.GetString(SR.RequiresNT)); } #else // !FEATURE_PAL throw new NotImplementedException("ROTORTODO"); #endif // !FEATURE_PAL if (mode == TransactionOption.Disabled) { executeWithoutTransaction = true; } if (executeWithoutTransaction) { // bypass the transaction logic callback(); transactionAborted = false; return; } TransactedInvocation call = new TransactedInvocation(callback); TransactedExecCallback execCallback = new TransactedExecCallback(call.ExecuteTransactedCode); PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_PENDING); int rc; try { rc = UnsafeNativeMethods.TransactManagedCallback(execCallback, (int)mode); } finally { PerfCounters.DecrementCounter(AppPerfCounter.TRANSACTIONS_PENDING); } // rethrow the expection originally caught in managed code if (call.Error != null) { throw new HttpException(null, call.Error); } PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_TOTAL); if (rc == 1) { PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_COMMITTED); transactionAborted = false; } else if (rc == 0) { PerfCounters.IncrementCounter(AppPerfCounter.TRANSACTIONS_ABORTED); transactionAborted = true; } else { throw new HttpException(SR.GetString(SR.Cannot_execute_transacted_code)); } }
internal /*public*/ static extern int TransactManagedCallback(TransactedExecCallback callback, int mode);