当前位置: 首页>>代码示例>>C#>>正文


C# Dispatcher.ClientOperation类代码示例

本文整理汇总了C#中System.ServiceModel.Dispatcher.ClientOperation的典型用法代码示例。如果您正苦于以下问题:C# ClientOperation类的具体用法?C# ClientOperation怎么用?C# ClientOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ClientOperation类属于System.ServiceModel.Dispatcher命名空间,在下文中一共展示了ClientOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ZipCodeInspector

 void IOperationBehavior.ApplyClientBehavior(OperationDescription operationDescription, 
     ClientOperation clientOperation) 
 {
     ZipCodeInspector zipCodeInspector = new ZipCodeInspector(); 
     
     clientOperation.ParameterInspectors.Add(zipCodeInspector); 
 }
开发者ID:cleancodenz,项目名称:ServiceBus,代码行数:7,代码来源:ZipCodeValidation.cs

示例2: ApplyClientBehavior

 public void ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
 {
     var dataContractSerializerOperationBehavior =
         description.Behaviors.Find<DataContractSerializerOperationBehavior>();
     dataContractSerializerOperationBehavior.DataContractResolver =
         new ProxyDataContractResolver();
 }
开发者ID:ntrhieu89,项目名称:ChineseCharacterTrainer,代码行数:7,代码来源:ApplyDataContractResolverAttribute.cs

示例3: ApplyClientBehavior

 public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
 {
     clientOperation.Formatter = new RestClientMessageFormatter(clientOperation.Formatter
         , operationDescription
         , this.Mapper
         , this.Configuration);
 }
开发者ID:spardo,项目名称:dotnet37signals,代码行数:7,代码来源:RestOperationBehavior.cs

示例4: ApplyClientBehavior

        public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
        {
            Console.WriteLine("{0}: ", clientOperation.Name);
            IClientMessageFormatter formatter = clientOperation.Formatter;
            Console.WriteLine("\t{0}", formatter.GetType().Name);

            if (formatter.GetType().Name != "CompositeClientFormatter")
            {
            return;
            }

            object innerFormatter = this.GetField(formatter, "request");
            Console.WriteLine("\t\t{0}", innerFormatter.GetType().Name);

            if (innerFormatter.GetType().Name == "UriTemplateClientFormatter")
            {
            innerFormatter = this.GetField(innerFormatter, "inner");
            Console.WriteLine("\t\t\t{0}", innerFormatter.GetType().Name);
            return;
            }

            if (innerFormatter.GetType().Name == "ContentTypeSettingClientMessageFormatter")
            {
            innerFormatter = this.GetField(innerFormatter, "innerFormatter");
            Console.WriteLine("\t\t\t{0}", innerFormatter.GetType().Name);

            if (innerFormatter.GetType().Name == "UriTemplateClientFormatter")
            {
                innerFormatter = this.GetField(innerFormatter, "inner");
                Console.WriteLine("\t\t\t\t{0}", innerFormatter.GetType().Name);
            }
            }
        }
开发者ID:huoxudong125,项目名称:WCF-Demo,代码行数:33,代码来源:DisplayClientMessageFormatter.cs

示例5: ApplyClientBehavior

 public void ApplyClientBehavior(OperationDescription description, ClientOperation runtime)
 {
     if (_runtime == runtime.Parent)
     {
         //在之前的创建的 Formatter 的基础上,装饰新的 Formatter
         runtime.Formatter = new BinaryFormatterAdapter(description.Name, runtime.SyncMethod.GetParameters(), runtime.Formatter, runtime.Action);
     }
 }
开发者ID:peterluo0822,项目名称:wcf-1,代码行数:8,代码来源:BinaryFormatterBehavior.cs

示例6: ApplyClientBehavior

        /// <summary>
        /// Apply the client behavior by requiring
        /// the use of the NetDataContractSerializer.
        /// </summary>
        /// <param name="description">Operation description.</param>
        /// <param name="proxy">Client operation object.</param>
        public void ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
        {
            description.Behaviors.Remove<DataContractSerializerOperationBehavior>();

            //直接让行为起作用,否则优先级的效果会不对。
            IOperationBehavior ndcob = new NetDataContractOperationBehavior(description);
            ndcob.ApplyClientBehavior(description, proxy);
            //description.Behaviors.Add(new NetDataContractOperationBehavior(description));
        }
开发者ID:hardCTE,项目名称:Rafy,代码行数:15,代码来源:UseNetDataContractAttribute.cs

示例7: GetFormatterFromRuntime

 internal static IClientMessageFormatter GetFormatterFromRuntime(OperationDescription operationDescription)
 {
     ClientOperation clientOperation = new ClientOperation(DummyClientRuntime, operationDescription.Name, operationDescription.Messages[0].Action);
     foreach (IOperationBehavior behavior in operationDescription.Behaviors)
     {
         behavior.ApplyClientBehavior(operationDescription, clientOperation);
     }
     return clientOperation.Formatter;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:ClientOperationFormatterProvider.cs

示例8: ApplyClientBehavior

    public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
    {
        foreach (ClientOperation clientOperation in clientRuntime.ClientOperations)
        {
            if (clientOperation.Name == "TestFaultWithKnownType")
            {
                testFaultWithKnownTypeClientOp = clientOperation;
                return;
            }
        }

        throw new Exception("Expected TestFaultWithKnownType in the ClientOperations, Actual:  TestFaultWithKnownType NOT Found");
    }
开发者ID:KKhurin,项目名称:wcf,代码行数:13,代码来源:FaultExceptionTests.cs

示例9: ApplyClientBehavior

        public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
        {
            clientOperation.SerializeRequest = true;
            clientOperation.DeserializeReply = true;
            var dataContractFormatAttribute = operationDescription.SyncMethod.GetCustomAttributes(typeof(DataContractFormatAttribute), true).FirstOrDefault() as DataContractFormatAttribute;
            if (null == dataContractFormatAttribute)
            {
                dataContractFormatAttribute = new DataContractFormatAttribute();
            }

            var dataContractSerializerOperationBehavior = operationDescription.Behaviors.Find<DataContractSerializerOperationBehavior>();
            clientOperation.Formatter = new CompressionMessageFormatter(this.Algorithm, operationDescription, dataContractFormatAttribute, dataContractSerializerOperationBehavior);
        }
开发者ID:kinpauln,项目名称:FreightForwarder,代码行数:13,代码来源:CompressionOperationBehaviorAttribute.cs

示例10: ProxyOperationRuntime

        internal ProxyOperationRuntime(ClientOperation operation, ImmutableClientRuntime parent)
        {
            if (operation == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation");
            if (parent == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent");

            this.parent = parent;
            this.formatter = operation.Formatter;
            this.isInitiating = operation.IsInitiating;
            this.isOneWay = operation.IsOneWay;
            this.isTerminating = operation.IsTerminating;
            this.isSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled;
            this.name = operation.Name;
            this.parameterInspectors = EmptyArray<IParameterInspector>.ToArray(operation.ParameterInspectors);
            this.faultFormatter = operation.FaultFormatter;
            this.serializeRequest = operation.SerializeRequest;
            this.deserializeReply = operation.DeserializeReply;
            this.action = operation.Action;
            this.replyAction = operation.ReplyAction;
            this.beginMethod = operation.BeginMethod;
            this.syncMethod = operation.SyncMethod;
            this.taskMethod = operation.TaskMethod;
            this.TaskTResult = operation.TaskTResult;

            if (this.beginMethod != null)
            {
                this.inParams = ServiceReflector.GetInputParameters(this.beginMethod, true);
                if (this.syncMethod != null)
                {
                    this.outParams = ServiceReflector.GetOutputParameters(this.syncMethod, false);
                }
                else
                {
                    this.outParams = NoParams;
                }
                this.endOutParams = ServiceReflector.GetOutputParameters(operation.EndMethod, true);
                this.returnParam = operation.EndMethod.ReturnParameter;
            }
            else if (this.syncMethod != null)
            {
                this.inParams = ServiceReflector.GetInputParameters(this.syncMethod, false);
                this.outParams = ServiceReflector.GetOutputParameters(this.syncMethod, false);
                this.returnParam = this.syncMethod.ReturnParameter;
            }

            if (this.formatter == null && (serializeRequest || deserializeReply))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ClientRuntimeRequiresFormatter0, this.name)));
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:51,代码来源:ProxyOperationRuntime.cs

示例11: ProxyOperationRuntime

        internal ProxyOperationRuntime(ClientOperation operation, ImmutableClientRuntime parent)
        {
            if (operation == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("operation");
            if (parent == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parent");

            _parent = parent;
            _formatter = operation.Formatter;
            _isInitiating = operation.IsInitiating;
            _isOneWay = operation.IsOneWay;
            _isTerminating = operation.IsTerminating;
            _isSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled;
            _name = operation.Name;
            _parameterInspectors = EmptyArray<IParameterInspector>.ToArray(operation.ParameterInspectors);
            _faultFormatter = operation.FaultFormatter;
            _serializeRequest = operation.SerializeRequest;
            _deserializeReply = operation.DeserializeReply;
            _action = operation.Action;
            _replyAction = operation.ReplyAction;
            _beginMethod = operation.BeginMethod;
            _syncMethod = operation.SyncMethod;
            _taskMethod = operation.TaskMethod;
            this.TaskTResult = operation.TaskTResult;

            if (_beginMethod != null)
            {
                _inParams = ServiceReflector.GetInputParameters(_beginMethod, true);
                if (_syncMethod != null)
                {
                    _outParams = ServiceReflector.GetOutputParameters(_syncMethod, false);
                }
                else
                {
                    _outParams = Array.Empty<ParameterInfo>();
                }
                _endOutParams = ServiceReflector.GetOutputParameters(operation.EndMethod, true);
                _returnParam = operation.EndMethod.ReturnParameter;
            }
            else if (_syncMethod != null)
            {
                _inParams = ServiceReflector.GetInputParameters(_syncMethod, false);
                _outParams = ServiceReflector.GetOutputParameters(_syncMethod, false);
                _returnParam = _syncMethod.ReturnParameter;
            }

            if (_formatter == null && (_serializeRequest || _deserializeReply))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.ClientRuntimeRequiresFormatter0, _name)));
            }
        }
开发者ID:shijiaxing,项目名称:wcf,代码行数:51,代码来源:ProxyOperationRuntime.cs

示例12:

 void IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
 {
     if (description == null)
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description");
     }
     if (proxy == null)
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("proxy");
     }
     if (proxy.Formatter == null)
     {
         bool flag;
         bool flag2;
         proxy.Formatter = (IClientMessageFormatter) this.GetFormatter(description, out flag, out flag2, true);
         proxy.SerializeRequest = flag;
         proxy.DeserializeReply = flag2;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:DataContractSerializerOperationBehavior.cs

示例13: ApplyClientBehavior

        public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
        {
            Console.WriteLine("{0}: ", clientOperation.Name);
            IClientMessageFormatter formatter = clientOperation.Formatter;
            Console.WriteLine("\t{0}", formatter.GetType().Name);

            if (formatter.GetType().Name != "CompositeClientFormatter")
            {
            return;
            }
            object innerFormatter = this.GetField(formatter, "reply");
            Console.WriteLine("\t\t{0}", innerFormatter.GetType().Name);

            if (innerFormatter.GetType().Name == "DemultiplexingClientMessageFormatter")
            {
            Dictionary<WebContentFormat, IClientMessageFormatter> formatters = this.GetField(innerFormatter,"formatters") as Dictionary<WebContentFormat, IClientMessageFormatter>;
            Console.WriteLine("\t\t\t{0, -4}: {1}", "Xml", formatters[WebContentFormat.Xml].GetType().Name);
            Console.WriteLine("\t\t\t{0, -4}: {1}", "Json", formatters[WebContentFormat.Json].GetType().Name);
            }
        }
开发者ID:huoxudong125,项目名称:WCF-Demo,代码行数:20,代码来源:DisplayClientMessageFormatter.cs

示例14: GetFormatterFromRuntime

        internal static IClientMessageFormatter GetFormatterFromRuntime(OperationDescription operationDescription)
        {
            System.ServiceModel.Dispatcher.ClientOperation clientOperation = new System.ServiceModel.Dispatcher.ClientOperation(DummyClientRuntime, operationDescription.Name, operationDescription.Messages[0].Action);

            // Default to DataContractSerializerOperationBehavior
            if (operationDescription.Behaviors.Count == 0)
            {
                IOperationBehavior operationBehavior = new DataContractSerializerOperationBehavior(operationDescription);
                operationBehavior.ApplyClientBehavior(operationDescription, clientOperation);
            }
            else
            {
                foreach (IOperationBehavior operationBehavior in operationDescription.Behaviors)
                {
                    operationBehavior.ApplyClientBehavior(operationDescription, clientOperation);
                }
            }

            return clientOperation.Formatter;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:20,代码来源:ClientOperationFormatterProvider.cs

示例15: ApplyClientBehavior

 public void ApplyClientBehavior(OperationDescription operationDescription, 
     ClientOperation clientOperation)
 {
 }
开发者ID:richet,项目名称:WcfRestContrib,代码行数:4,代码来源:RedirectBehavior.cs


注:本文中的System.ServiceModel.Dispatcher.ClientOperation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。