/*******************************************************************************
* 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
{
///
/// 客户端终结点行为的行为扩展
///
public class MyClientBehavior : BehaviorExtensionElement, IEndpointBehavior
{
///
/// 获取行为的类型
///
public override Type BehaviorType
{
get
{
return typeof(MyClientBehavior);
}
}
///
/// 基于当前配置设置来创建行为扩展
///
/// 行为扩展
protected override object CreateBehavior()
{
return new MyClientBehavior();
}
#region IEndpointBehavior Members
///
/// 实现此方法可以在运行时将数据传递给绑定,从而支持自定义行为
///
/// 要修改的终结点
/// 绑定元素支持该行为所需的对象
public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
{
}
///
/// 在终结点范围内实现客户端的修改或扩展
///
/// 要自定义的终结点
/// 要自定义的客户端运行时
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.MessageInspectors.Add(new ClientInterpector());
}
///
/// 在终结点范围内实现客户端的修改或扩展
///
/// 公开协定的终结点
/// 要修改或扩展的终结点调度程序
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
}
///
/// 现此方法可以确认终结点是否满足某些设定条件
///
/// 要验证的终结点
public void Validate(ServiceEndpoint endpoint)
{
}
#endregion
}
}