• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Dispatcher.ClientOperation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ApplyClientBehavior

 public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
 {
     throw new NotSupportedException();
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:4,代码来源:WebCacheAttribute.cs


示例17: BuildProxyOperation

        private static void BuildProxyOperation(OperationDescription operation, ClientRuntime parent)
        {
            ClientOperation child;
            if (operation.Messages.Count == 1)
            {
                child = new ClientOperation(parent, operation.Name, operation.Messages[0].Action);
            }
            else
            {
                child = new ClientOperation(parent, operation.Name, operation.Messages[0].Action,
                                            operation.Messages[1].Action);
            }
            child.TaskMethod = operation.TaskMethod;
            child.TaskTResult = operation.TaskTResult;
            child.SyncMethod = operation.SyncMethod;
            child.BeginMethod = operation.BeginMethod;
            child.EndMethod = operation.EndMethod;
            child.IsOneWay = operation.IsOneWay;
            child.IsTerminating = operation.IsTerminating;
            child.IsInitiating = operation.IsInitiating;
            child.IsSessionOpenNotificationEnabled = operation.IsSessionOpenNotificationEnabled;
            for (int i = 0; i < operation.Faults.Count; i++)
            {
                FaultDescription fault = operation.Faults[i];
                child.FaultContractInfos.Add(new FaultContractInfo(fault.Action, fault.DetailType, fault.ElementName, fault.Namespace, operation.KnownTypes));
            }

            parent.Operations.Add(child);
        }
开发者ID:shijiaxing,项目名称:wcf,代码行数:29,代码来源:DispatcherBuilder.cs


示例18:

        void IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
        {
            if (description == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description");

            if (proxy == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("proxy");

            if (proxy.Formatter != null)
                return;

            bool formatRequest;
            bool formatReply;
            proxy.Formatter = (IClientMessageFormatter)GetFormatter(description, out formatRequest, out formatReply, true);
            proxy.SerializeRequest = formatRequest;
            proxy.DeserializeReply = formatReply;
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:17,代码来源:DataContractSerializerOperationBehavior.cs


示例19:

 void IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy)
 {
 }
开发者ID:weshaggard,项目名称:wcf,代码行数:3,代码来源:OperationInvokerBehavior.cs


示例20: ApplyClientBehavior

 public void ApplyClientBehavior(OperationDescription operationDescription, ClientOperation clientOperation)
 {
     clientOperation.ParameterInspectors.Add(new Inspector());
 }
开发者ID:apavlo11356,项目名称:adamdotcom-services,代码行数:4,代码来源:CSVBehavior.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Dispatcher.ClientRuntime类代码示例发布时间:2022-05-26
下一篇:
C# Dispatcher.ChannelDispatcher类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap