System.Transactions.PreparingEnlistment.RecoveryInformation C# (CSharp) Method

RecoveryInformation() public method

public RecoveryInformation ( ) : byte[]
return byte[]
        public byte[] RecoveryInformation()
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
            }

            try
            {
                lock (_internalEnlistment.SyncRoot)
                {
                    return _internalEnlistment.State.RecoveryInformation(_internalEnlistment);
                }
            }
            finally
            {
                if (etwLog.IsEnabled())
                {
                    etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
                }
            }
        }

Usage Example

        public virtual void Prepare(PreparingEnlistment preparingEnlistment)
        {
            Trace.WriteIf(Tracing.Is.TraceVerbose, string.Empty);
            if (null == preparingEnlistment)
            {
                return;
            }

            try
            {
                Operation.Info = Convert.ToBase64String(preparingEnlistment.RecoveryInformation());
                if (ConfigureOperation() &&
                    Operation.Do())
                {
                    Trace.WriteIf(Tracing.Is.TraceVerbose, "preparingEnlistment.Prepared()");
                    preparingEnlistment.Prepared();
                    return;
                }

                Trace.WriteIf(Tracing.Is.TraceVerbose, "preparingEnlistment.ForceRollback()");
                preparingEnlistment.ForceRollback();
            }
            catch (Exception exception)
            {
                Trace.TraceError("{0}", exception);
                preparingEnlistment.ForceRollback(exception);
            }
        }
All Usage Examples Of System.Transactions.PreparingEnlistment::RecoveryInformation