src/Orleans.Core/Runtime/RequestContextExtensions.cs
/// <summary>
/// Imports the specified context data into the current <see cref="RequestContext"/>, clearing all existing values.
/// </summary>
/// <param name="contextData">The context data.</param>
Imports the specified context data into the current , clearing all existing values.
Imports the specified context data into the current clearing all existing values .
public static void Import(Dictionary<string, object> contextData)
        {
            if (RequestContext.PropagateActivityId)
            {
                object activityIdObj = Guid.Empty;
                if (contextData?.TryGetValue(RequestContext.E2_E_TRACING_ACTIVITY_ID_HEADER, out activityIdObj) == true)
                {
                    Trace.CorrelationManager.ActivityId = (Guid)activityIdObj;
                }
                else
                {
                    Trace.CorrelationManager.ActivityId = Guid.Empty;
                }
            }
            if (contextData != null && contextData.Count > 0)
            {
                var values = contextData.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
                RequestContext.CallContextData.Value = values;
            }
            else
            {
                RequestContext.Clear();
            }
        }
public static void Import ( Dictionary < string , object > contextData ) { if ( RequestContext . PropagateActivityId ) { object activityIdObj = Guid . Empty ; if ( contextData ? . TryGetValue ( RequestContext . E2_E_TRACING_ACTIVITY_ID_HEADER , out activityIdObj ) == true ) { Trace . CorrelationManager . ActivityId = ( Guid ) activityIdObj ; } else { Trace . CorrelationManager . ActivityId = Guid . Empty ; } } if ( contextData != null && contextData . Count > 0 ) { var values = contextData . ToDictionary ( kvp => kvp . Key , kvp => kvp . Value ) ; RequestContext . CallContextData . Value = values ; } else { RequestContext . Clear ( ) ; } }
Imports the specified context data into the current , clearing all existing values.
Imports the specified context data into the current clearing all existing values .
// We have some data, so store RC data into the async local field. // Clear any previous RC data from the async local field. // MUST CLEAR the LLC, so that previous request LLC does not leak into this one.
contextData
Dictionary<string, object>
The context data.
The context data .