Ejemplo n.º 1
0
        public void ApplyDispatchBehavior(OperationDescription description,
                                          DispatchOperation dispatch)
        {
            _curBehavior = new CustomDataContractSerializerOperationBehavior(description);
            IOperationBehavior innerBehavior = _curBehavior;

            innerBehavior.ApplyDispatchBehavior(description, dispatch);
        }
Ejemplo n.º 2
0
        static void BindOperations(ContractDescription contract, ClientRuntime proxy, DispatchRuntime dispatch)
        {
            if (!(((proxy == null) != (dispatch == null))))
            {
                throw Fx.AssertAndThrowFatal("DispatcherBuilder.BindOperations: ((proxy == null) != (dispatch == null))");
            }

            MessageDirection local = (proxy == null) ? MessageDirection.Input : MessageDirection.Output;

            for (int i = 0; i < contract.Operations.Count; i++)
            {
                OperationDescription operation = contract.Operations[i];
                MessageDescription   first     = operation.Messages[0];

                if (first.Direction != local)
                {
                    if (proxy == null)
                    {
                        proxy = dispatch.CallbackClientRuntime;
                    }

                    ClientOperation proxyOperation = proxy.Operations[operation.Name];
                    Fx.Assert(proxyOperation != null, "");

                    for (int j = 0; j < operation.Behaviors.Count; j++)
                    {
                        IOperationBehavior behavior = operation.Behaviors[j];
                        behavior.ApplyClientBehavior(operation, proxyOperation);
                    }
                }
                else
                {
                    if (dispatch == null)
                    {
                        dispatch = proxy.CallbackDispatchRuntime;
                    }

                    DispatchOperation dispatchOperation = null;
                    if (dispatch.Operations.Contains(operation.Name))
                    {
                        dispatchOperation = dispatch.Operations[operation.Name];
                    }
                    if (dispatchOperation == null && dispatch.UnhandledDispatchOperation != null && dispatch.UnhandledDispatchOperation.Name == operation.Name)
                    {
                        dispatchOperation = dispatch.UnhandledDispatchOperation;
                    }

                    if (dispatchOperation != null)
                    {
                        for (int j = 0; j < operation.Behaviors.Count; j++)
                        {
                            IOperationBehavior behavior = operation.Behaviors[j];
                            behavior.ApplyDispatchBehavior(operation, dispatchOperation);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public void ApplyDispatchBehavior(OperationDescription description, DispatchOperation runtime)
 {
     if (innerFormatterBehavior != null && runtime.Formatter == null)
     {
         // no formatter has been applied yet
         innerFormatterBehavior.ApplyDispatchBehavior(description, runtime);
     }
     runtime.Formatter = new QueryStringFormatter(description.Name, description.SyncMethod.GetParameters(), runtime.Formatter);
 }
 public void ApplyDispatchBehavior(OperationDescription description, DispatchOperation runtime)
 {
     if (innerFormatterBehavior != null && runtime.Formatter == null)
     {
         // no formatter has been applied yet
         innerFormatterBehavior.ApplyDispatchBehavior(description, runtime);
     }
     runtime.Formatter = new OpenCMISResponseFormatter(runtime.Formatter);
 }
Ejemplo n.º 5
0
 public void ApplyDispatchBehavior(OperationDescription operationDescription,
                                   DispatchOperation dispatchOperation)
 {
     if (dispatchOperation == null)
     {
         throw new ArgumentNullException("dispatchOperation");
     }
     if (_innerFormatterBehavior != null && dispatchOperation.Formatter == null)
     {
         _innerFormatterBehavior.ApplyDispatchBehavior(operationDescription, dispatchOperation);
     }
     dispatchOperation.Formatter = new WcfDispatchMessageFormatter(dispatchOperation.Formatter,
                                                                   new WcfMessageEncodingContext(_endpoint, operationDescription, dispatchOperation),
                                                                   _messageEncodingController);
 }
Ejemplo n.º 6
0
 public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
 {
     foreach (OperationDescription operation in endpoint.Contract.Operations)
     {
         IOperationBehavior serializerBehavior = operation.Behaviors.Find <XmlSerializerOperationBehavior>();
         if (null == serializerBehavior)
         {
             serializerBehavior = operation.Behaviors.Find <DataContractSerializerOperationBehavior>();
         }
         serializerBehavior.ApplyDispatchBehavior(operation, endpointDispatcher.DispatchRuntime.Operations[operation.Name]);
     }
     foreach (DispatchOperation operation in endpointDispatcher.DispatchRuntime.Operations)
     {
         operation.Formatter = new CompressionMessageFormatter(this.MessageCompressor, operation.Formatter, null);
     }
 }
 /// <summary>
 /// Implements a modification or extension of the service accross an operation.
 /// </summary>
 /// <param name="operationDescription">The operation being examined. Use for examination only. If the operation
 /// description is modified, the results are undefined.</param>
 /// <param name="dispatchOperation">The run-time object that exposes customization properties for the operation
 /// described by <paramref name="operationDescription"/>.</param>
 public void ApplyDispatchBehavior(OperationDescription operationDescription, DispatchOperation dispatchOperation)
 {
     operationBehavior.ApplyDispatchBehavior(operationDescription, dispatchOperation);
 }