12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #if FEAT_SERVICEMODEL && PLAT_XMLSERIALIZER
- using System.ServiceModel.Description;
- namespace ProtoBuf.ServiceModel
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public class ProtoEndpointBehavior : IEndpointBehavior
- {
- #region IEndpointBehavior Members
- void IEndpointBehavior.AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
- {
- }
- void IEndpointBehavior.ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
- {
- ReplaceDataContractSerializerOperationBehavior(endpoint);
- }
- void IEndpointBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
- {
- ReplaceDataContractSerializerOperationBehavior(endpoint);
- }
- void IEndpointBehavior.Validate(ServiceEndpoint endpoint)
- {
- }
- private static void ReplaceDataContractSerializerOperationBehavior(ServiceEndpoint serviceEndpoint)
- {
- foreach (OperationDescription operationDescription in serviceEndpoint.Contract.Operations)
- {
- ReplaceDataContractSerializerOperationBehavior(operationDescription);
- }
- }
- private static void ReplaceDataContractSerializerOperationBehavior(OperationDescription description)
- {
- DataContractSerializerOperationBehavior dcsOperationBehavior = description.Behaviors.Find<DataContractSerializerOperationBehavior>();
- if (dcsOperationBehavior != null)
- {
- description.Behaviors.Remove(dcsOperationBehavior);
- ProtoOperationBehavior newBehavior = new ProtoOperationBehavior(description);
- newBehavior.MaxItemsInObjectGraph = dcsOperationBehavior.MaxItemsInObjectGraph;
- description.Behaviors.Add(newBehavior);
- }
- }
- #endregion
- }
- }
- #endif
|