Пример #1
0
        private static void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime)
        {
            // contract behaviors
            ContractDescription contractDescription = serviceEndpoint.Contract;

            for (int i = 0; i < contractDescription.Behaviors.Count; i++)
            {
                IContractBehavior behavior = contractDescription.Behaviors[i];
                behavior.ApplyClientBehavior(contractDescription, serviceEndpoint, clientRuntime);
            }
            // endpoint behaviors
            BindingInformationEndpointBehavior.Instance.ApplyClientBehavior(serviceEndpoint, clientRuntime);
            for (int i = 0; i < serviceEndpoint.Behaviors.Count; i++)
            {
                IEndpointBehavior behavior = serviceEndpoint.Behaviors[i];
                behavior.ApplyClientBehavior(serviceEndpoint, clientRuntime);
            }
            // operation behaviors
            DispatcherBuilder.BindOperations(contractDescription, clientRuntime, null);
        }
 /// <summary>
 /// Implements a modification or extension of the client across an endpoint.
 /// </summary>
 /// <param name="endpoint">The endpoint that is to be customized.</param>
 /// <param name="clientRuntime">The client runtime to be customized.</param>
 public void ApplyClientBehavior(
     ServiceEndpoint endpoint,
     ClientRuntime clientRuntime)
 {
     endpointBehavior.ApplyClientBehavior(endpoint, clientRuntime);
 }