e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
53 lines
1.9 KiB
C#
53 lines
1.9 KiB
C#
//----------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//----------------------------------------------------------------
|
|
namespace System.ServiceModel.Discovery
|
|
{
|
|
using System.ServiceModel.Channels;
|
|
using System.ServiceModel.Description;
|
|
using System.ServiceModel.Dispatcher;
|
|
|
|
class DiscoveryOperationContextExtensionInitializer : IEndpointBehavior, IDispatchMessageInspector
|
|
{
|
|
DiscoveryOperationContextExtension discoveryOperationContextExtension;
|
|
|
|
public DiscoveryOperationContextExtensionInitializer(DiscoveryOperationContextExtension discoveryOperationContextExtension)
|
|
{
|
|
this.discoveryOperationContextExtension = discoveryOperationContextExtension;
|
|
}
|
|
|
|
void IEndpointBehavior.AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
|
|
{
|
|
}
|
|
|
|
void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
|
|
{
|
|
}
|
|
|
|
void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
|
|
{
|
|
if (endpointDispatcher == null)
|
|
{
|
|
throw FxTrace.Exception.ArgumentNull("endpointDispatcher");
|
|
}
|
|
|
|
|
|
endpointDispatcher.DispatchRuntime.MessageInspectors.Add(this);
|
|
}
|
|
|
|
void IEndpointBehavior.Validate(ServiceEndpoint endpoint)
|
|
{
|
|
}
|
|
|
|
object IDispatchMessageInspector.AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
|
|
{
|
|
OperationContext.Current.Extensions.Add(this.discoveryOperationContextExtension);
|
|
return null;
|
|
}
|
|
|
|
void IDispatchMessageInspector.BeforeSendReply(ref Message reply, object correlationState)
|
|
{
|
|
}
|
|
}
|
|
}
|