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

首頁(yè) > 編程 > .NET > 正文

實(shí)戰(zhàn) .Net 數(shù)據(jù)訪問(wèn)層 - 13

2024-07-10 13:03:21
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
具體的data access logic實(shí)現(xiàn)技術(shù),作者感覺已沒有必要多加討

論,相信只要是有過(guò)ado.net開發(fā)經(jīng)驗(yàn)的同志都比較清楚應(yīng)該怎

么做,網(wǎng)上的資料也浩如煙海,非常齊全!



在此,就以作者自己的一段data access logic代碼來(lái)結(jié)束關(guān)于它的討論:



代碼11:使用data access logic進(jìn)行remoting調(diào)用 – 1,基本操作

class customerdal_orm : mydal

{

protected internal mycustomer getallcustomers()

{

mycustomer cust = null;



// 獲取distributed process類型

string typedist = getdistributiontype();

switch (typedist)

{

case distributiontype.remoting :

{

// 通過(guò)cache management訪問(wèn)數(shù)據(jù),第2參數(shù)是個(gè)delegate,

// 一旦cache失效,就直接通過(guò)該delegate刷新數(shù)據(jù)

arraylist al = cachemanager.current.getcache(

getcacheparam(), getallcustomers_remoting_delegate);

... // 對(duì)remoting返回的數(shù)據(jù)進(jìn)行處理

break;

}



default :

throw new exception(

"unsupported distributiontype: " +

typedist + "!");

}



return cust;

}

}

}

















































































上面的是基本訪問(wèn)代碼,由于使用了cache management,所以

我們還需要一段真正可以訪問(wèn)數(shù)據(jù)的代碼,一旦cache失效,就可

以通過(guò)它來(lái)再次獲得數(shù)據(jù)并刷新緩存!

需要特別注意的是:上面的代碼使用了c# 2.0中的anonymous

delegate功能,如果在visual studio .net 2003種進(jìn)行編譯,必須將

getallcustomers_remoting_delegate參數(shù)修改為如下方式:

new getarraylist(getallcustomers_remoting_delegate)

(這里的getarraylist就是真正定義的delegate類型)



下一段:http://www.csdn.net/develop/read_article.asp?id=27557
,歡迎訪問(wèn)網(wǎng)頁(yè)設(shè)計(jì)愛好者web開發(fā)。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 镇平县| 桐乡市| 大悟县| 兴和县| 明水县| 二手房| 会理县| 淮阳县| 容城县| 宁波市| 大悟县| 屏山县| 岳池县| 东兰县| 仁寿县| 神农架林区| 长治市| 陇西县| 新源县| 鹤山市| 宜黄县| 霸州市| 黔西县| 新干县| 凯里市| 兴业县| 泰宁县| 麻江县| 瑞丽市| 玉溪市| 湖南省| 临邑县| 夹江县| 阿克陶县| 镶黄旗| 怀柔区| 梓潼县| 周宁县| 昭通市| 常德市| 韶关市|