WCF双工会话通道基本创建步骤详解

WCF开发插件拥有非常大的功能优势,这些优势决定了其在开发领域中占据着一定的主导地位。我们今天就先从WCF双工会话通道的基本概念开始了解,来对这一开发工具进行更加深入的了解。

成都创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于成都做网站、成都网站设计、铜鼓网络推广、重庆小程序开发、铜鼓网络营销、铜鼓企业策划、铜鼓品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;成都创新互联公司为所有大学生创业者提供铜鼓建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.com

从对象模型的角度来看,会话通道形状与非会话通道只有一些细微的差别。例如,IDuplexSessionChannel是IDuplexChannel和 ISessionChannel的结合体。因为我们已有有了一个DelegatorDuplexChannel类型定义(它实现了IDuplexChannel接口),创建一个WCF双工会话通道仅仅是一个继承DelegatorDuplexChannel并实现IDuplexSessionChannel接口的问题,如下所示:

 
 
 
  1. internal sealed class DelegatorDuplexSessionChannel :
     DelegatorDuplexChannel, IDuplexSessionChannel   
  2. {   
  3. private IDuplexSessionChannel _innerSessionChannel;   
  4. // reference the next                                                       
  5. // sessionful channel   
  6. private String _source;   
  7. // store the String to output internal  
  8. DelegatorDuplexSessionChannel(ChannelManagerBase    
  9. channelManagerBase, IDuplexSessionChannel innerChannel, String source)    
    : base(channelManagerBase, innerChannel, source)   
  10. {      
  11. _source = String.Format("{0} CHANNEL: DelegatorDuplexSessionChannel",      
    source);      
  12. PrintHelper.Print(_source, "ctor");      
  13. // assign the reference to the next sessionful channel      
  14. this._innerSessionChannel = innerChannel;   
  15. }    
  16. // IDuplexSessionChannel member that is not defined in IDuplexChannel   
  17. public IDuplexSession Session   
  18. {      
  19. get {        
  20. PrintHelper.Print(_source, "Session");       
  21. return this._innerSessionChannel.Session;   
  22. }      
  23. }  

DelegatorDuplexChannel包含一个IDuplexChannel类型的成员变量,我们需要通过一个IDuplexSessionChannel类型的局部变量来存储同一个对象的引用。这样做可以使得我们容易地添加Session属性到我们的类型定义上。

以上就是对WCF双工会话通道的相关介绍。

文章标题:WCF双工会话通道基本创建步骤详解
本文路径:http://www.hantingmc.com/qtweb/news42/72742.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联