国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

IDesign C#編碼規(guī)范(之九)

2024-07-21 02:18:56
字體:
供稿:網(wǎng)友
國(guó)內(nèi)最大的酷站演示中心!
4.5遠(yuǎn)程操作 remoting
1.寧可使用管理配置(配置文件)而不使用程序自動(dòng)配置。
prefer administrator configuration to programmatic configation.
2.總是在單獨(dú)調(diào)用對(duì)象里完成idisposable。
always implement idisposable on single call objects.
3.遠(yuǎn)程操作時(shí)總是選用tcp信道和二進(jìn)制格式
always prefer tcp channel and binary format when using remoting.
a)除非設(shè)置了防火墻
unless a firewall is present.
4.總是為一扎對(duì)象提供一個(gè)null租約。
always provide a null lease for a singleton object.
public class mysingleton : marshalbyrefobject
{
public override object initializelifetimeservice()
{
return null;
}
}
5.總是為客戶端激活的對(duì)象提供sponsor。這個(gè)sponsor應(yīng)該返回初始租約時(shí)刻。
always provide a sponsor for client activated object. the sponsor should return the initial lease time.
a) see chapter 10 of programming .net components.
6.在客戶端應(yīng)用程序停止時(shí)總是不要注冊(cè)sponsor。
always unregister the sponsor on client application shutdown.
7.總是將遠(yuǎn)程對(duì)象放在類庫里。
always put remote objects in class libraries.
8.避免使用soapsuds。
avoid using soapsuds.
9.避免宿主iis.
avoid hosting in iis.
10.避免使用單一定向的信道。
avoid using uni-directional channels.
11.總是在main()方法里載入遠(yuǎn)程配置文件,即使該文件為空。并且該應(yīng)用程序沒有使用遠(yuǎn)程操作。
always load a remoting configuration file in main() even if the file is empty, and the application does not use remoting.
a)允許在該文件重新定義遠(yuǎn)程調(diào)用,配置信道和改變應(yīng)用程序發(fā)布(添加信道等)等。
allow the option of remoting some types later on, post deployment, and changing the application topology.
static void main()
{
remotingconfiguration.configue(“myapp.exe.config”);
/*rest of main()*/
}
12.避免對(duì)遠(yuǎn)程對(duì)象激活時(shí)使用activator.getobject() and activator.createinstance()。而是使用new。
avoid using activator.getobject() and activator.createinstance() for remote objects activation. use new instead.
13.總是在客戶端注冊(cè)port(),目的是允許遞歸調(diào)用。
always register port() on the client side, to allow callbacks.
14.總是將客戶端和服務(wù)器端的類型過濾設(shè)置為full,使其可以遞歸調(diào)用。
always elevate type filtering to full on both client and host to allow callbacks.
host config file:
<channels>
<channel ref = “tcp” port = “8005”>
<serverproviders>
<formatter ref = “soap” typefilterlevel = “full”/>
<formatter ref = “binary” typefilterlevel = “full”/>
</serverproviders>
</channel>
<channel ref = “http” port = “8006”>
<serverproviders>
<formatter ref = “soap” typefilterlevel = “full”/>
<formatter ref = “binary” typefilterlevel = “full/”>
</serverproviders>
</channel>
</channels>
client config file:
<channels>
<channel ref = “tcp” port = “0”>
<serverproviders>
<formatter ref = “soap” typefilterlevel = “full”/>
<formatter ref = “binary” typefilterlevel = “full”/>
</serverproviders>
</channel>
</channels>

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 察隅县| 常州市| 罗田县| 深州市| 陆川县| 锦州市| 治多县| 大港区| 云和县| 余庆县| 微博| 阿拉善盟| 英山县| 布拖县| 固原市| 包头市| 布尔津县| 平定县| 麻阳| 扶沟县| 绥棱县| 区。| 莆田市| 星座| 垦利县| 大兴区| 广灵县| 虹口区| 衡阳市| 民勤县| 嘉定区| 阜新市| 怀来县| 庄河市| 崇礼县| 九寨沟县| 镇江市| 钦州市| 衡水市| 新安县| 伊宁县|