private void ClientScheduleOnReceiveMessageCore(NativeActivityContext executionContext, ReceiveMessageInstanceData instance) { instance.InitializeContextAndCallbackContext(); CorrelationHandle ambientCorrelation = instance.GetAmbientCorrelation(executionContext); if (instance.CorrelationRequestContext.CorrelationKeyCalculator != null) { instance.CorrelationRequestContext.Reply = MessagingActivityHelper.InitializeCorrelationHandles(executionContext, null, ambientCorrelation, this.correlationInitializers, instance.CorrelationRequestContext.CorrelationKeyCalculator, instance.CorrelationRequestContext.Reply); } if (instance.CorrelationContext != null) { CorrelationHandle explicitContextCorrelation = CorrelationHandle.GetExplicitContextCorrelation(executionContext, this.correlationInitializers); if (explicitContextCorrelation == null) { explicitContextCorrelation = ambientCorrelation; } if (explicitContextCorrelation != null) { explicitContextCorrelation.Context = instance.CorrelationContext; } } System.ServiceModel.Channels.Message reply = instance.CorrelationRequestContext.Reply; this.Message.Set(executionContext, reply); }
public static bool TryGetContextCorrelationHandle(this Collection <CorrelationInitializer> correlationInitializers, NativeActivityContext context, out CorrelationHandle correlationHandle) { correlationHandle = CorrelationHandle.GetExplicitContextCorrelation(context, correlationInitializers); return(correlationHandle != null); }