Esempio n. 1
0
        internal static void ExportToMessage(Message msg)
        {
            Dictionary <string, object> values = GetContextData();

            if (PropagateActivityId)
            {
                Guid activityId = Trace.CorrelationManager.ActivityId;
                if (activityId != Guid.Empty)
                {
                    values = values == null ? new Dictionary <string, object>() : new Dictionary <string, object>(values); // Create new copy before mutating data
                    values[E2_E_TRACING_ACTIVITY_ID_HEADER] = activityId;
                    // We have some changed data, so write RC data back into LogicalCallContext
                    SetContextData(values);
                }
            }
            if (values != null && values.Count != 0)
            {
                msg.SetApplicationHeaders(values);
            }
        }