编写人生
写写代码,写写人生
博客园
社区
首页
新随笔
联系
管理
订阅
随笔- 178 文章- 0 评论- 508
实现自己的配置读取器
[HostProtection(SecurityAction.LinkDemand, MayLeakOnAbort
=
true
)]
public
class
AddinSectionHandler : IConfigurationSectionHandler
{
public
object
Create(
object
parent,
object
context, XmlNode section)
{
List
<
AddinConfigItem
>
colItems;
if
(parent
==
null
)
{
colItems
=
new
List
<
AddinConfigItem
>
();
}
else
{
List
<
AddinConfigItem
>
colParent
=
(List
<
AddinConfigItem
>
)parent;
colItems
=
new
List
<
AddinConfigItem
>
(colParent);
}
AddinConfigItem item;
foreach
(XmlNode nodeItem
in
section.ChildNodes)
{
item
=
new
AddinConfigItem();
item.DllFile
=
nodeItem.Attributes[
"
dllFile
"
].Value;
item.AddinClass
=
nodeItem.Attributes[
"
addinClass
"
].Value;
colItems.Add(item);
}
return
colItems;
}
}
public
class
AddinConfigItem
{
private
string
_dllFile;
public
string
DllFile
{
get
{
return
_dllFile; }
set
{ _dllFile
=
value; }
}
private
string
_addinClass;
public
string
AddinClass
{
get
{
return
_addinClass; }
set
{ _addinClass
=
value; }
}
}
配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="Assemblys"
type="Dcms.Common.AddinSectionHandler,Dcms.Common"/>
</configSections>
<Assemblys>
<Assembly dllFile="a.dll" addinClass="a" />
<Assembly dllFile="b.dll" addinClass="b" />
</Assemblys>
</configuration>
参考文章:
http://www.codeproject.com/aspnet/ConfigSections.asp
posted @ 2005-08-11 13:46
编写人生
阅读(154)
评论(0)
编辑
收藏
社区
新闻
新用户注册
刷新评论列表
标题
姓名
主页
Email
(只有博主才能看到)
验证码
*
看不清,换一张
[
登录
][
注册
]
内容(请不要发表任何与政治相关的内容)
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
该文被作者在 2005-08-12 12:02 编辑过
相关文章:
在Windows下配置与使用CVSNT
tomcat中的几点配置说明
Ajax实现无刷新三联动下拉框
Subversion配置安装教程(一)
实现土豆网的视频播放
利用 Remoting 实现异步队列机制
相关链接:
最新IT新闻:
淘宝网合并阿里妈妈 专家称阿里巴巴或有新战略
微软研究院发布 AutoCollage - 整理并融合照片
2008年9月5日科技博客精选
SNS网站风靡影响工作效率 公司下令封杀
《孢子》正式发布
博客园新闻频道
博客园首页
社区
公告
Web
tansm.cnblogs.com
<
2005年8月
>
日
一
二
三
四
五
六
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
与我联系
发短消息
搜索
常用链接
我的随笔
我的空间
我的短信
我的评论
更多链接
我的参与
我的新闻
最新评论
我的标签
我的标签
Torridity(2)
Entity Framework(2)
性能(2)
ORM(2)
LinQ(2)
DataSet(1)
Insert(1)
发明畅想(1)
随笔档案
2008年6月 (4)
2008年5月 (3)
2008年4月 (6)
2008年3月 (5)
2008年2月 (1)
2008年1月 (4)
2007年12月 (2)
2007年11月 (2)
2007年10月 (2)
2007年9月 (5)
2007年8月 (2)
2007年7月 (4)
2007年6月 (1)
2007年5月 (1)
2007年4月 (3)
2007年3月 (5)
2007年2月 (1)
2006年12月 (2)
2006年11月 (7)
2006年10月 (4)
2006年9月 (1)
2006年8月 (8)
2006年7月 (6)
2006年6月 (7)
2006年5月 (2)
2006年4月 (1)
2006年3月 (8)
2006年2月 (6)
2006年1月 (2)
2005年12月 (5)
2005年11月 (3)
2005年10月 (2)
2005年9月 (4)
2005年8月 (12)
2005年7月 (12)
2005年6月 (2)
2005年5月 (4)
2005年4月 (1)
2005年1月 (13)
2004年12月 (6)
2004年11月 (9)
相册
taobao
收藏夹
WinFX(8)
(rss)
编程朋友
AdamBear 越学越没底
(rss)
Arbean
Masterpiece 纯爷们!在乎?
(rss)
Validation Application Block: Revealed
我的高中同学录
怎么捅破那层纸?(续)
很好的性能调优的文章,包括内存和SQL的
积分与排名
积分 - 126304
排名 - 300
最新评论
1. re: 压缩空气动力自行车
到底外国有没有发明出来呀拿出证据来,省得我们白费力气瞎讨论。 (大胡子)
2. re: 压缩空气动力自行车
续航能力在50公里左右,冲气时间在10分钟左右,最大载重在85公斤左右,使用成本跟电动车差不多,一定有前景,我相信。
(565622394)
3. re: 压缩空气动力自行车
一群人在扯淡,天天想的都没到关键上,你把气源问题解决了先,而且要能够确实控制成本!
冠鼎不就骗子么?上次看到他们家网站,不过现在网站都没了。携款跑咯,一群没脑子的人。 (你们都在做梦)
4. re: 微型电动轿车(发明畅想)
这种微型电动轿车,现在实现起来并不难,可能除了电池技术。 微型轿车,如果能够车体可变大变小,那存放、通行就方便了,稳定性、安全性也就提高了。 我琢磨了些这方面的,申请了个发... (赵金龙)
5. re: 压缩空气动力自行车
续航能力在50公里左右,冲气时间在10分钟左右,最大载重在85公斤左右,使用成本跟电动车差不多,一定有前景,我相信。 (565622394)
阅读排行榜
1. 压缩空气动力自行车(11787)
2. 我们为什么使用ORM?(10163)
3. ORM的世界(修订版)(3978)
4. System.ComponentModel.Component入门(3740)
5. 在 .NET 2.0 中享受 .NET 3.0的特性(3362)
评论排行榜
1. 压缩空气动力自行车(169)
2. 从LinQ看我们的ORM设计(27)
3. 我们为什么使用ORM?(16)
4. 在 .NET 2.0 中享受 .NET 3.0的特性(15)
5. 程序的可扩展性 Vs. 开放源代码(14)