|
由于信道管理器在客戶(hù)端和服務(wù)端所起的不同作用,分為信道監(jiān)聽(tīng)器和信道工廠(chǎng)。和服務(wù)端的信道監(jiān)聽(tīng)其相比,處于客戶(hù)端的信道工廠(chǎng)顯得簡(jiǎn)單。從名稱(chēng)就可以看得出來(lái),信道工廠(chǎng)的作用就是單純的創(chuàng)建用于消息發(fā)送的信道。我們先來(lái)看看與信道工廠(chǎng)相關(guān)的一些接口和基類(lèi)的定義。
一、信道工廠(chǎng)相關(guān)的接口和基類(lèi)
對(duì)于信道監(jiān)聽(tīng)器,WCF定義了兩個(gè)接口:IChannelListener和IChnnelListener。與之相對(duì)地,WCF也為信道工廠(chǎng)定義了兩個(gè)接口:IChannelFactory和IChannelFactory。這兩個(gè)接口定義了信道工廠(chǎng)最基本的功能和屬性,下面是這兩個(gè)接口的定義:
public interface IChannelFactory : ICommunicationObject
{
// Methods
T GetProperty<T>() where T : class;
}
public interface IChannelFactory<TChannel> : IChannelFactory, ICommunicationObject
{
// Methods
TChannel CreateChannel(EndpointAddress to);
TChannel CreateChannel(EndpointAddress to, Uri via);
}
NET技術(shù):[WCF的Binding模型]之四:信道工廠(chǎng)(Channel Factory),轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。