void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext context)
 {
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "ISerializable.GetObjectData");
     }
     if (this.Disposed)
     {
         throw new ObjectDisposedException("Transaction");
     }
     if (serializationInfo == null)
     {
         throw new ArgumentNullException("serializationInfo");
     }
     if (this.complete)
     {
         throw TransactionException.CreateTransactionCompletedException(System.Transactions.SR.GetString("TraceSourceLtm"));
     }
     lock (this.internalTransaction)
     {
         this.internalTransaction.State.GetObjectData(this.internalTransaction, serializationInfo, context);
     }
     if (DiagnosticTrace.Information)
     {
         TransactionSerializedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), this.TransactionTraceId);
     }
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "ISerializable.GetObjectData");
     }
 }
Ejemplo n.º 2
0
        // Ask the state machine for serialization info.
        //
        void ISerializable.GetObjectData(
            SerializationInfo serializationInfo,
            StreamingContext context)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "ISerializable.GetObjectData");
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (serializationInfo == null)
            {
                throw new ArgumentNullException(nameof(serializationInfo));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(SR.TraceSourceLtm, DistributedTxId);
            }

            lock (_internalTransaction)
            {
                _internalTransaction.State.GetObjectData(_internalTransaction, serializationInfo, context);
            }

            if (DiagnosticTrace.Information)
            {
                TransactionSerializedTraceRecord.Trace(SR.TraceSourceLtm, TransactionTraceId);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.TraceSourceLtm, "ISerializable.GetObjectData");
            }
        }
 public void GetObjectData(SerializationInfo serializationInfo, StreamingContext context)
 {
     if (serializationInfo == null)
     {
         throw new ArgumentNullException("serializationInfo");
     }
     byte[] transmitterPropagationToken = null;
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxTransaction.GetObjectData");
     }
     transmitterPropagationToken = TransactionInterop.GetTransmitterPropagationToken(this);
     serializationInfo.SetType(typeof(OletxTransaction));
     serializationInfo.AddValue("OletxTransactionPropagationToken", transmitterPropagationToken);
     if (DiagnosticTrace.Information)
     {
         TransactionSerializedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), this.TransactionTraceId);
     }
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxTransaction.GetObjectData");
     }
 }