Create() статический приватный Метод

static private Create ( TraceSourceType traceSource, string message, Exception innerException ) : TransactionException
traceSource TraceSourceType
message string
innerException Exception
Результат TransactionException
 private void PushServiceDomain(Transaction newCurrent)
 {
     if (((newCurrent == null) || !newCurrent.Equals(ContextUtil.SystemTransaction)) && ((newCurrent != null) || (ContextUtil.SystemTransaction != null)))
     {
         ServiceConfig cfg = new ServiceConfig();
         try
         {
             if (newCurrent != null)
             {
                 cfg.Synchronization = SynchronizationOption.RequiresNew;
                 ServiceDomain.Enter(cfg);
                 this.createdDoubleServiceDomain   = true;
                 cfg.Synchronization               = SynchronizationOption.Required;
                 cfg.BringYourOwnSystemTransaction = newCurrent;
             }
             ServiceDomain.Enter(cfg);
             this.createdServiceDomain = true;
         }
         catch (COMException exception)
         {
             if (System.Transactions.Oletx.NativeMethods.XACT_E_NOTRANSACTION == exception.ErrorCode)
             {
                 throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceBase"), System.Transactions.SR.GetString("TransactionAlreadyOver"), exception);
             }
             throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceBase"), exception.Message, exception);
         }
         finally
         {
             if (!this.createdServiceDomain && this.createdDoubleServiceDomain)
             {
                 ServiceDomain.Leave();
             }
         }
     }
 }
Пример #2
0
        internal static TransactionException Create(string traceSource, string message, Exception innerException, Guid distributedTxId)
        {
            string messagewithTxId = message;

            if (IncludeDistributedTxId(distributedTxId))
            {
                messagewithTxId = String.Format(SR.GetString(SR.DistributedTxIDInTransactionException), messagewithTxId, distributedTxId);
            }

            return(TransactionException.Create(traceSource, messagewithTxId, innerException));
        }
        private static void TimerCallback(object state)
        {
            TransactionScope scope = state as TransactionScope;

            if (scope == null)
            {
                if (DiagnosticTrace.Critical)
                {
                    InternalErrorTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceBase"), System.Transactions.SR.GetString("TransactionScopeTimerObjectInvalid"));
                }
                throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceBase"), System.Transactions.SR.GetString("InternalError") + System.Transactions.SR.GetString("TransactionScopeTimerObjectInvalid"), null);
            }
            scope.Timeout();
        }
Пример #4
0
        private static void TimerCallback(object state)
        {
            TransactionScope scope = state as TransactionScope;

            if (null == scope)
            {
                TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
                if (etwLog.IsEnabled())
                {
                    etwLog.TransactionScopeInternalError("TransactionScopeTimerObjectInvalid");
                }

                throw TransactionException.Create(TraceSourceType.TraceSourceBase, SR.InternalError + SR.TransactionScopeTimerObjectInvalid, null);
            }

            scope.Timeout();
        }
Пример #5
0
 internal static TransactionException CreateTransactionStateException(string traceSource, Exception innerException)
 {
     return(TransactionException.Create(traceSource, SR.GetString(SR.TransactionStateException),
                                        innerException));
 }