| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:MyClientBehavior.cs
- * 2.功能描述:客户端终结点行为的行为扩展
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2014/08/13 1.00 新建
- *******************************************************************************/
- using System;
- using System.ServiceModel.Channels;
- using System.ServiceModel.Configuration;
- using System.ServiceModel.Description;
- using System.ServiceModel.Dispatcher;
- namespace Dongke.IBOSS.PRD.WCF.Proxys.ClientInterpector
- {
- /// <summary>
- /// 客户端终结点行为的行为扩展
- /// </summary>
- public class MyClientBehavior : BehaviorExtensionElement, IEndpointBehavior
- {
- /// <summary>
- /// 获取行为的类型
- /// </summary>
- public override Type BehaviorType
- {
- get
- {
- return typeof(MyClientBehavior);
- }
- }
- /// <summary>
- /// 基于当前配置设置来创建行为扩展
- /// </summary>
- /// <returns>行为扩展</returns>
- protected override object CreateBehavior()
- {
- return new MyClientBehavior();
- }
- #region IEndpointBehavior Members
- /// <summary>
- /// 实现此方法可以在运行时将数据传递给绑定,从而支持自定义行为
- /// </summary>
- /// <param name="endpoint">要修改的终结点</param>
- /// <param name="bindingParameters">绑定元素支持该行为所需的对象</param>
- public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
- {
- }
- /// <summary>
- /// 在终结点范围内实现客户端的修改或扩展
- /// </summary>
- /// <param name="endpoint">要自定义的终结点</param>
- /// <param name="clientRuntime">要自定义的客户端运行时</param>
- public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
- {
- clientRuntime.MessageInspectors.Add(new ClientInterpector());
- }
- /// <summary>
- /// 在终结点范围内实现客户端的修改或扩展
- /// </summary>
- /// <param name="endpoint">公开协定的终结点</param>
- /// <param name="endpointDispatcher">要修改或扩展的终结点调度程序</param>
- public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
- {
- }
- /// <summary>
- /// 现此方法可以确认终结点是否满足某些设定条件
- /// </summary>
- /// <param name="endpoint">要验证的终结点</param>
- public void Validate(ServiceEndpoint endpoint)
- {
- }
- #endregion
- }
- }
|