当前位置:IT168首页 > 技术开发 > 概述
[收藏此页] [打印] [推荐] [评论]

在线修改KeyValue配置节

责任编辑:nancy作者:ITPUB论坛   2008-07-11   
【内容导航】
文本Tag: 微软 sql

【IT168技术文档】

  web.config中有一些自定义keyvalue配置节,想要在线修改,找了半天没找到现成的,自己写了一个:

  就是类似这样的配置节:
<system.framework> <add key="SystemFramework.Tracing.Enabled" value="True" /> <add key="SystemFramework.Tracing.TraceLevel" value="4" /> </system.framework>
  写了4个类:
  配置项:NameValueConfigurationItem
public sealed class NameValueConfigurationItem : System.Configuration.ConfigurationElement { private static ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection(); private static readonly ConfigurationProperty _value = new ConfigurationProperty("value", typeof(string), string.Empty, ConfigurationPropertyOptions.IsRequired); private static readonly ConfigurationProperty _key = new ConfigurationProperty("key", typeof(string), string.Empty, ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired); static NameValueConfigurationItem() { _properties.Add(_key); _properties.Add(_value); } internal NameValueConfigurationItem() { } public NameValueConfigurationItem(string key, string value) { base[_key] = key; base[_value] = value; } [ConfigurationProperty("value", IsRequired = true)] public string Value { get { return (string)base[_value]; } } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } [ConfigurationProperty("key", IsRequired = true, IsKey = true)] public string Key { get { return (string)base[_key]; } } }

上一页
1
23下一页
收藏到: 添加到“百度搜藏”添加到“QQ书签”添加到“Google书签”添加到“Yahoo收藏”添加到“和讯网摘”
【内容导航】
本文欢迎转载,转载请注明:转载自IT168 [ http://www.it168.com/ ]
本文链接:http://tech.it168.com/d/2008-07-11/200807111237724.shtml
技术开发相关文章  
  • 暂无
友情推介