System.Transactions.TransactionException.Create C# (CSharp) Method

Create() static private method

static private Create ( TraceSourceType traceSource, string message, Exception innerException ) : TransactionException
traceSource TraceSourceType
message string
innerException Exception
return TransactionException
        internal static TransactionException Create(TraceSourceType traceSource, string message, Exception innerException)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.TransactionExceptionTrace(TransactionExceptionType.TransactionException, message, innerException.ToString());
            }

            return new TransactionException(message, innerException);
        }

Same methods

TransactionException::Create ( TraceSourceType traceSource, string message, Exception innerException, Guid distributedTxId ) : TransactionException
TransactionException::Create ( TraceSourceType traceSource, string message, Guid distributedTxId ) : TransactionException
TransactionException::Create ( string message, Exception innerException ) : TransactionException
TransactionException::Create ( string message, Exception innerException, Guid distributedTxId ) : TransactionException
TransactionException::Create ( string message, Guid distributedTxId ) : TransactionException

Usage Example

 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();
             }
         }
     }
 }
All Usage Examples Of System.Transactions.TransactionException::Create