TransactionException.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / tx / System / Transactions / TransactionException.cs / 1305376 / TransactionException.cs

                            using System; 
using System.Runtime.Serialization;
using System.Transactions.Diagnostics;

 
namespace System.Transactions
{ 
    ///  
    /// Summary description for TransactionException.
    ///  
    [Serializable]
    public class TransactionException : System.SystemException
    {
        internal static TransactionException Create( string traceSource, string message, Exception innerException ) 
        {
            if ( DiagnosticTrace.Error ) 
            { 
                TransactionExceptionTraceRecord.Trace( traceSource,
                    message 
                    );
            }

            return new TransactionException( message, 
                innerException );
        } 
 

        internal static TransactionException CreateTransactionStateException( string traceSource, Exception innerException ) 
        {
            return TransactionException.Create( traceSource, SR.GetString( SR.TransactionStateException ),
                innerException );
        } 

 
        internal static Exception CreateEnlistmentStateException( string traceSource, Exception innerException ) 
        {
            if ( DiagnosticTrace.Error ) 
            {
                InvalidOperationExceptionTraceRecord.Trace( traceSource,
                    SR.GetString( SR.EnlistmentStateException )
                    ); 
            }
 
            return new InvalidOperationException( SR.GetString( SR.EnlistmentStateException ), 
                innerException );
        } 


        internal static Exception CreateTransactionCompletedException( string traceSource )
        { 
            if ( DiagnosticTrace.Error )
            { 
                InvalidOperationExceptionTraceRecord.Trace( traceSource, 
                    SR.GetString( SR.TransactionAlreadyCompleted )
                    ); 
            }

            return new InvalidOperationException( SR.GetString( SR.TransactionAlreadyCompleted ) );
        } 

 
        internal static Exception CreateInvalidOperationException( string traceSource, string message, Exception innerException ) 
        {
            if ( DiagnosticTrace.Error ) 
            {
                InvalidOperationExceptionTraceRecord.Trace( traceSource,
                    message
                    ); 
            }
 
            return new InvalidOperationException( message, innerException ); 
        }
 

        /// 
        ///
        ///  
        public TransactionException()
        { 
        } 

        ///  
        ///
        /// 
        /// 
        public TransactionException( 
            string message
            ) : base( message ) 
        { 
        }
 
        /// 
        ///
        /// 
        ///  
        /// 
        public TransactionException( 
            string message, 
            Exception innerException
            ) : base( message, innerException ) 
        {
        }

        ///  
        ///
        ///  
        ///  
        /// 
        protected TransactionException( 
            SerializationInfo info,
            StreamingContext context
            ) : base( info, context )
        { 
        }
 
    } 

 

    /// 
    /// Summary description for TransactionAbortedException.
    ///  
    [Serializable]
    public class TransactionAbortedException : TransactionException 
    { 
        internal static new TransactionAbortedException Create( string traceSource, string message, Exception innerException )
        { 
            if ( DiagnosticTrace.Error )
            {
                TransactionExceptionTraceRecord.Trace( traceSource,
                    message 
                    );
            } 
 
            return new TransactionAbortedException( message,
                innerException ); 
        }

        internal static TransactionAbortedException Create( string traceSource, Exception innerException )
        { 
            return TransactionAbortedException.Create( traceSource, SR.GetString( SR.TransactionAborted ), innerException );
        } 
 
        /// 
        /// 
        /// 
        public TransactionAbortedException( ) : base( SR.GetString( SR.TransactionAborted ))
        {
        } 

        ///  
        /// 
        /// 
        ///  
        public TransactionAbortedException(
            string message
            ) : base( message )
        { 

        } 
 
        /// 
        /// 
        /// 
        /// 
        /// 
        public TransactionAbortedException( 
            string message,
            Exception innerException 
            ) : base( message, innerException ) 
        {
        } 

        /// 
        ///
        ///  
        /// 
        ///  
        internal TransactionAbortedException( 
            Exception innerException
            ) : base( SR.GetString( SR.TransactionAborted ), innerException ) 
        {
        }

        ///  
        ///
        ///  
        ///  
        /// 
        protected TransactionAbortedException( 
            SerializationInfo info,
            StreamingContext context
            ) : base( info, context )
        { 
        }
    } 
 

 
    /// 
    /// Summary description for TransactionInDoubtException.
    /// 
    [Serializable] 
    public class TransactionInDoubtException : TransactionException
    { 
        internal static new TransactionInDoubtException Create( string traceSource, string message, Exception innerException ) 
        {
            if ( DiagnosticTrace.Error ) 
            {
                TransactionExceptionTraceRecord.Trace( traceSource,
                    message
                    ); 
            }
 
            return new TransactionInDoubtException( message, 
                innerException );
        } 

        internal static TransactionInDoubtException Create( string traceSource, Exception innerException )
        {
            return TransactionInDoubtException.Create( traceSource, SR.GetString( SR.TransactionIndoubt ), innerException ); 
        }
 
        ///  
        ///
        ///  
        public TransactionInDoubtException( ) : base( SR.GetString( SR.TransactionIndoubt ))
        {
        }
 
        /// 
        /// 
        ///  
        /// 
        public TransactionInDoubtException( 
            string message
            ) : base( message )
        {
 
        }
 
        ///  
        ///
        ///  
        /// 
        /// 
        public TransactionInDoubtException(
            string message, 
            Exception innerException
            ) : base( message, innerException ) 
        { 
        }
 
        /// 
        ///
        /// 
        ///  
        /// 
        protected TransactionInDoubtException( 
            SerializationInfo info, 
            StreamingContext context
            ) : base( info, context ) 
        {
        }
    }
 
    /// 
    /// Summary description for TransactionManagerCommunicationException. 
    ///  
    [Serializable]
    public class TransactionManagerCommunicationException : TransactionException 
    {
        internal static new TransactionManagerCommunicationException Create( string traceSource, string message, Exception innerException )
        {
            if ( DiagnosticTrace.Error ) 
            {
                TransactionExceptionTraceRecord.Trace( traceSource, 
                    message 
                    );
            } 

            return new TransactionManagerCommunicationException( message,
                innerException );
        } 

        internal static TransactionManagerCommunicationException Create( string traceSource, Exception innerException ) 
        { 
            return TransactionManagerCommunicationException.Create( traceSource, SR.GetString( SR.TransactionManagerCommunicationException ), innerException );
        } 

        /// 
        ///
        ///  
        public TransactionManagerCommunicationException( ) : base( SR.GetString( SR.TransactionManagerCommunicationException ))
        { 
        } 

        ///  
        ///
        /// 
        /// 
        public TransactionManagerCommunicationException( 
            string message
            ) : base( message ) 
        { 

        } 

        /// 
        ///
        ///  
        /// 
        ///  
        public TransactionManagerCommunicationException( 
            string message,
            Exception innerException 
            ) : base( message, innerException )
        {
        }
 
        /// 
        /// 
        ///  
        /// 
        ///  
        protected TransactionManagerCommunicationException(
            SerializationInfo info,
            StreamingContext context
            ) : base( info, context ) 
        {
        } 
    } 

 
    [Serializable]
    public class TransactionPromotionException : TransactionException
    {
        ///  
        ///
        ///  
        public TransactionPromotionException() : this( SR.GetString( SR.PromotionFailed )) 
        {
        } 

        /// 
        ///
        ///  
        /// 
        public TransactionPromotionException( 
            string message 
            ) : base( message )
        { 

        }

        ///  
        ///
        ///  
        ///  
        /// 
        public TransactionPromotionException( 
            string message,
            Exception innerException
            ) : base( message, innerException )
        { 
        }
 
        ///  
        ///
        ///  
        /// 
        /// 
        protected TransactionPromotionException(
            SerializationInfo info, 
            StreamingContext context
            ) : base( info, context ) 
        { 
        }
    } 

}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System; 
using System.Runtime.Serialization;
using System.Transactions.Diagnostics;

 
namespace System.Transactions
{ 
    ///  
    /// Summary description for TransactionException.
    ///  
    [Serializable]
    public class TransactionException : System.SystemException
    {
        internal static TransactionException Create( string traceSource, string message, Exception innerException ) 
        {
            if ( DiagnosticTrace.Error ) 
            { 
                TransactionExceptionTraceRecord.Trace( traceSource,
                    message 
                    );
            }

            return new TransactionException( message, 
                innerException );
        } 
 

        internal static TransactionException CreateTransactionStateException( string traceSource, Exception innerException ) 
        {
            return TransactionException.Create( traceSource, SR.GetString( SR.TransactionStateException ),
                innerException );
        } 

 
        internal static Exception CreateEnlistmentStateException( string traceSource, Exception innerException ) 
        {
            if ( DiagnosticTrace.Error ) 
            {
                InvalidOperationExceptionTraceRecord.Trace( traceSource,
                    SR.GetString( SR.EnlistmentStateException )
                    ); 
            }
 
            return new InvalidOperationException( SR.GetString( SR.EnlistmentStateException ), 
                innerException );
        } 


        internal static Exception CreateTransactionCompletedException( string traceSource )
        { 
            if ( DiagnosticTrace.Error )
            { 
                InvalidOperationExceptionTraceRecord.Trace( traceSource, 
                    SR.GetString( SR.TransactionAlreadyCompleted )
                    ); 
            }

            return new InvalidOperationException( SR.GetString( SR.TransactionAlreadyCompleted ) );
        } 

 
        internal static Exception CreateInvalidOperationException( string traceSource, string message, Exception innerException ) 
        {
            if ( DiagnosticTrace.Error ) 
            {
                InvalidOperationExceptionTraceRecord.Trace( traceSource,
                    message
                    ); 
            }
 
            return new InvalidOperationException( message, innerException ); 
        }
 

        /// 
        ///
        ///  
        public TransactionException()
        { 
        } 

        ///  
        ///
        /// 
        /// 
        public TransactionException( 
            string message
            ) : base( message ) 
        { 
        }
 
        /// 
        ///
        /// 
        ///  
        /// 
        public TransactionException( 
            string message, 
            Exception innerException
            ) : base( message, innerException ) 
        {
        }

        ///  
        ///
        ///  
        ///  
        /// 
        protected TransactionException( 
            SerializationInfo info,
            StreamingContext context
            ) : base( info, context )
        { 
        }
 
    } 

 

    /// 
    /// Summary description for TransactionAbortedException.
    ///  
    [Serializable]
    public class TransactionAbortedException : TransactionException 
    { 
        internal static new TransactionAbortedException Create( string traceSource, string message, Exception innerException )
        { 
            if ( DiagnosticTrace.Error )
            {
                TransactionExceptionTraceRecord.Trace( traceSource,
                    message 
                    );
            } 
 
            return new TransactionAbortedException( message,
                innerException ); 
        }

        internal static TransactionAbortedException Create( string traceSource, Exception innerException )
        { 
            return TransactionAbortedException.Create( traceSource, SR.GetString( SR.TransactionAborted ), innerException );
        } 
 
        /// 
        /// 
        /// 
        public TransactionAbortedException( ) : base( SR.GetString( SR.TransactionAborted ))
        {
        } 

        ///  
        /// 
        /// 
        ///  
        public TransactionAbortedException(
            string message
            ) : base( message )
        { 

        } 
 
        /// 
        /// 
        /// 
        /// 
        /// 
        public TransactionAbortedException( 
            string message,
            Exception innerException 
            ) : base( message, innerException ) 
        {
        } 

        /// 
        ///
        ///  
        /// 
        ///  
        internal TransactionAbortedException( 
            Exception innerException
            ) : base( SR.GetString( SR.TransactionAborted ), innerException ) 
        {
        }

        ///  
        ///
        ///  
        ///  
        /// 
        protected TransactionAbortedException( 
            SerializationInfo info,
            StreamingContext context
            ) : base( info, context )
        { 
        }
    } 
 

 
    /// 
    /// Summary description for TransactionInDoubtException.
    /// 
    [Serializable] 
    public class TransactionInDoubtException : TransactionException
    { 
        internal static new TransactionInDoubtException Create( string traceSource, string message, Exception innerException ) 
        {
            if ( DiagnosticTrace.Error ) 
            {
                TransactionExceptionTraceRecord.Trace( traceSource,
                    message
                    ); 
            }
 
            return new TransactionInDoubtException( message, 
                innerException );
        } 

        internal static TransactionInDoubtException Create( string traceSource, Exception innerException )
        {
            return TransactionInDoubtException.Create( traceSource, SR.GetString( SR.TransactionIndoubt ), innerException ); 
        }
 
        ///  
        ///
        ///  
        public TransactionInDoubtException( ) : base( SR.GetString( SR.TransactionIndoubt ))
        {
        }
 
        /// 
        /// 
        ///  
        /// 
        public TransactionInDoubtException( 
            string message
            ) : base( message )
        {
 
        }
 
        ///  
        ///
        ///  
        /// 
        /// 
        public TransactionInDoubtException(
            string message, 
            Exception innerException
            ) : base( message, innerException ) 
        { 
        }
 
        /// 
        ///
        /// 
        ///  
        /// 
        protected TransactionInDoubtException( 
            SerializationInfo info, 
            StreamingContext context
            ) : base( info, context ) 
        {
        }
    }
 
    /// 
    /// Summary description for TransactionManagerCommunicationException. 
    ///  
    [Serializable]
    public class TransactionManagerCommunicationException : TransactionException 
    {
        internal static new TransactionManagerCommunicationException Create( string traceSource, string message, Exception innerException )
        {
            if ( DiagnosticTrace.Error ) 
            {
                TransactionExceptionTraceRecord.Trace( traceSource, 
                    message 
                    );
            } 

            return new TransactionManagerCommunicationException( message,
                innerException );
        } 

        internal static TransactionManagerCommunicationException Create( string traceSource, Exception innerException ) 
        { 
            return TransactionManagerCommunicationException.Create( traceSource, SR.GetString( SR.TransactionManagerCommunicationException ), innerException );
        } 

        /// 
        ///
        ///  
        public TransactionManagerCommunicationException( ) : base( SR.GetString( SR.TransactionManagerCommunicationException ))
        { 
        } 

        ///  
        ///
        /// 
        /// 
        public TransactionManagerCommunicationException( 
            string message
            ) : base( message ) 
        { 

        } 

        /// 
        ///
        ///  
        /// 
        ///  
        public TransactionManagerCommunicationException( 
            string message,
            Exception innerException 
            ) : base( message, innerException )
        {
        }
 
        /// 
        /// 
        ///  
        /// 
        ///  
        protected TransactionManagerCommunicationException(
            SerializationInfo info,
            StreamingContext context
            ) : base( info, context ) 
        {
        } 
    } 

 
    [Serializable]
    public class TransactionPromotionException : TransactionException
    {
        ///  
        ///
        ///  
        public TransactionPromotionException() : this( SR.GetString( SR.PromotionFailed )) 
        {
        } 

        /// 
        ///
        ///  
        /// 
        public TransactionPromotionException( 
            string message 
            ) : base( message )
        { 

        }

        ///  
        ///
        ///  
        ///  
        /// 
        public TransactionPromotionException( 
            string message,
            Exception innerException
            ) : base( message, innerException )
        { 
        }
 
        ///  
        ///
        ///  
        /// 
        /// 
        protected TransactionPromotionException(
            SerializationInfo info, 
            StreamingContext context
            ) : base( info, context ) 
        { 
        }
    } 

}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.

                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK