WCF学习笔记三:使用自定义行为扩展WCF总结
2010-06-03 14:09
766 查看
服务站: 使用自定义行为扩展 WCF文中详细的描述了自定义行为扩展点,下面对这些扩展点的扩展方法进行总结
调度程序扩展点
1、消息检查:EndpointDispatcher.DispatchRuntime.MessageInspectors.Add(IDispatchMessageInspector);
2、操作选择器:EndpointDispatcher.DispatchRuntime.OperationSelector = IDispatchOperationSelector;
3、消息格式化(反序列化):DispatchOperation.Formatter = IDispatchMessageFormatter;
4、参数检查:DispatchOperation.ParameterInspectors.Add(IparameterInspector);
5、操作调用程序:DispatchOperation.Invoker = IOperationInvoker;
获取DispatchRuntime实例的几种方式【DispatchRuntime 类】
a、在ServiceHost中
b、在IServiceBehavior接口的ApplyDispatchBehavior中
c、在IEndpointBehavior接口的ApplyDispatchBehavior中
d、在IContractBehavior接口的ApplyDispatchBehavior中
获取DispatchOperation实例的几种方式【DispatchOperation类】
a、在IOperationBehavior接口的ApplyDispatchBehavior中
b、在DispatchRuntime实例中
代理(客户端)扩展点
1、参数检查:ClientOperation.ParameterInspectors.Add(IparameterInspector);
2、消息格式化(序列化):ClientOperation.Formatter = IClientMessageFormatter;
?、操作选择器:ClientRuntime.OperationSelector = IClientOperationSelector;
3、消息检查:ClientRuntime.MessageInspectors.Add(IClientMessageInspector);
获取ClientRuntime实例的几种方式【ClientRuntime类】
a、在IEndpointBehavior接口的ApplyClientBehavior中
b、在IContractBehavior接口的ApplyClientBehavior中
获取ClientOperation实例的几种方式【ClientOperation类】
a、在IOperationBehavior接口的ApplyClientBehavior中
b、在ClientRuntime实例中
将I...Behavior添加到ServiceHost中的方法
1、IServiceBehavior
2、IEndpointBehavior
3、IContractBehavior
4、IOperationBehavior
将I...Behavior添加到Client的Endpoint中的方法
1、IEndpointBehavior
2、IContractBehavior
3、IOperationBehavior
获取Client的Endpoint的方法:
1、ClientBase.Endpoint
2、ChannelFactory.Endpoint
调度程序扩展点
1、消息检查:EndpointDispatcher.DispatchRuntime.MessageInspectors.Add(IDispatchMessageInspector);
2、操作选择器:EndpointDispatcher.DispatchRuntime.OperationSelector = IDispatchOperationSelector;
3、消息格式化(反序列化):DispatchOperation.Formatter = IDispatchMessageFormatter;
4、参数检查:DispatchOperation.ParameterInspectors.Add(IparameterInspector);
5、操作调用程序:DispatchOperation.Invoker = IOperationInvoker;
获取DispatchRuntime实例的几种方式【DispatchRuntime 类】
a、在ServiceHost中
foreach (ChannelDispatcher cDispatcher in host.ChannelDispatchers) foreach (EndpointDispatcher endpointDispatcher in cDispatcher.Endpoints) endpointDispatcher.DispatchRuntime...
b、在IServiceBehavior接口的ApplyDispatchBehavior中
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase) { foreach (ChannelDispatcher cDispatcher in serviceHostBase.ChannelDispatchers) foreach (EndpointDispatcher endpointDispatcher in cDispatcher.Endpoints) endpointDispatcher.DispatchRuntime... }
c、在IEndpointBehavior接口的ApplyDispatchBehavior中
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { endpointDispatcher.DispatchRuntime... }
d、在IContractBehavior接口的ApplyDispatchBehavior中
public void ApplyDispatchBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.DispatchRuntime dispatchRuntime) { dispatchRuntime... }
获取DispatchOperation实例的几种方式【DispatchOperation类】
a、在IOperationBehavior接口的ApplyDispatchBehavior中
public void ApplyDispatchBehavior(OperationDescription operationDescription, System.ServiceModel.Dispatcher.DispatchOperation dispatchOperation) { dispatchOperation... }
b、在DispatchRuntime实例中
foreach (DispatchOperation dispatchOperation in DispatchRuntime.Operations) dispatchOperation...
代理(客户端)扩展点
1、参数检查:ClientOperation.ParameterInspectors.Add(IparameterInspector);
2、消息格式化(序列化):ClientOperation.Formatter = IClientMessageFormatter;
?、操作选择器:ClientRuntime.OperationSelector = IClientOperationSelector;
3、消息检查:ClientRuntime.MessageInspectors.Add(IClientMessageInspector);
获取ClientRuntime实例的几种方式【ClientRuntime类】
a、在IEndpointBehavior接口的ApplyClientBehavior中
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime) { clientRuntime... }
b、在IContractBehavior接口的ApplyClientBehavior中
public void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { clientRuntime... }
获取ClientOperation实例的几种方式【ClientOperation类】
a、在IOperationBehavior接口的ApplyClientBehavior中
public void ApplyClientBehavior(OperationDescription operationDescription, System.ServiceModel.Dispatcher.ClientOperation clientOperation) { clientOperation... }
b、在ClientRuntime实例中
foreach(ClientOperation clientOperation in ClientRuntime.Operations) clientOperation...
将I...Behavior添加到ServiceHost中的方法
1、IServiceBehavior
ServiceHost.Description.Behaviors.Add(IServiceBehavior);
2、IEndpointBehavior
foreach (ServiceEndpoint endpoint in ServiceHost.Description.Endpoints) { endpoint.Behaviors.Add(IEndpointBehavior); }
3、IContractBehavior
foreach (ServiceEndpoint endpoint in ServiceHost.Description.Endpoints) { endpoint.Contract.Behaviors.Add(IContractBehavior); }
4、IOperationBehavior
foreach (ServiceEndpoint endpoint in ServiceHost.Description.Endpoints) { foreach (OperationDescription operationDescription in endpoint.Contract.Operations) { operationDescription.Behaviors.Add(IOperationBehavior); } }
将I...Behavior添加到Client的Endpoint中的方法
1、IEndpointBehavior
Endpoint.Behaviors.Add(IEndpointBehavior);
2、IContractBehavior
Endpoint.Contract.Behaviors.Add(IContractBehavior);
3、IOperationBehavior
foreach (OperationDescription operationDescription in Endpoint.Contract.Operations) { operationDescription.Behaviors.Add(IOperationBehavior); }
获取Client的Endpoint的方法:
1、ClientBase.Endpoint
2、ChannelFactory.Endpoint
相关文章推荐
- WCF学习笔记1(体系架构和行为扩展)
- (转)使用自定义行为扩展 WCF
- vim扩展功能(高效率编程)使用学习笔记
- 学习笔记之 WCF安全(6) 数字证书 自定义证书验证+ 客户端 证书验证(wshttpBinding)
- iPhone开发学习笔记005——使用XIB自定义一个UIView,然后将这个view添加到controller的view
- WCF学习笔记(六)自定义绑定和C/S之间传输流的绑定
- Flex企业应用开发实践学习笔记(六)——使用ActionScript创建自定义组件
- Spring学习笔记(十八):使用jeesite时的一些问题总结
- [每日一学]MFC学习笔记——自定义消息的使用
- 【学习笔记】Spring AOP注解使用总结
- selenium 学习笔记 ---新手学习记录(4) 问题总结(java)-autoit3脚本使用
- ASP.NET MVC学习笔记-----使用自定义的View Engine
- Asp.net学习笔记----使用GridView+ObjectDataSource进行自定义分页排序
- Java学习笔记:this使用总结
- 微软企业库4.1学习笔记(三)企业库迁移和并行使用,以及企业库的扩展
- 【Unity 3D游戏开发学习笔记】总结摄像机和光源的使用方法
- php学习笔记(十八)php扩展库mysqli的使用和处理结果集
- cURL 学习笔记与总结(4)使用 cURL 从 ftp 上下载文件与上传文件到 ftp
- sqlserver -- 学习笔记(一)自定义函数(学习总结,备忘)
- Animation & Animator使用方法(Mooc Android加薪利器--自定义view 代码学习笔记)