public static byte[] GetExportCookie(Transaction transaction, byte[] whereabouts)
        {
            if (null == transaction)
            {
                throw new ArgumentNullException(nameof(transaction));
            }

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

            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;

            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceDistributed, "TransactionInterop.GetExportCookie");
            }

            // Copy the whereabouts so that it cannot be modified later.
            var whereaboutsCopy = new byte[whereabouts.Length];

            Buffer.BlockCopy(whereabouts, 0, whereaboutsCopy, 0, whereabouts.Length);

            DistributedTransaction dTx = ConvertToDistributedTransaction(transaction);

            byte[] cookie = dTx.GetExportCookie(whereaboutsCopy);

            if (etwLog.IsEnabled())
            {
                etwLog.MethodExit(TraceSourceType.TraceSourceDistributed, "TransactionInterop.GetExportCookie");
            }

            return(cookie);
        }
예제 #2
0
        public static byte[] GetExportCookie(Transaction transaction, byte[] whereabouts)
        {
            if (null == transaction)
            {
                throw new ArgumentNullException(nameof(transaction));
            }

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

            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceDistributed, "TransactionInterop.GetExportCookie");
            }

            // Copy the whereabouts so that it cannot be modified later.
            var whereaboutsCopy = new byte[whereabouts.Length];

            Buffer.BlockCopy(whereabouts, 0, whereaboutsCopy, 0, whereabouts.Length);

            DistributedTransaction dTx = ConvertToDistributedTransaction(transaction);

            byte[] cookie = dTx.GetExportCookie(whereaboutsCopy);

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.TraceSourceDistributed, "TransactionInterop.GetExportCookie");
            }

            return(cookie);
        }