扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:钟峰 来源:中汉软件有限公司 2007年11月3日
关键字:
public class DataSystemsSection : ConfigurationSection { private static readonly ConfigurationProperty _dataSystems = new ConfigurationProperty(null, typeof(DataSystemElementCollection), null, ConfigurationPropertyOptions.IsDefaultCollection); private static ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection(); static DataSystemsSection() { _properties.Add(_dataSystems); } public DataSystemElementCollection DataSystems { get { return (DataSystemElementCollection)base[_dataSystems]; } } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } } |
public class DataSystemElement : ConfigurationElement { private static readonly ConfigurationProperty _name = new ConfigurationProperty("name", typeof(string), null, null, new StringValidator(1), ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired); private static readonly ConfigurationProperty _currentProvider = new ConfigurationProperty("currentProvider", typeof(string), string.Empty, ConfigurationPropertyOptions.IsRequired); private static readonly ConfigurationProperty _dataModules = new ConfigurationProperty("dataModules", typeof(DataModuleElementCollection), null, ConfigurationPropertyOptions.None); private static readonly ConfigurationProperty _dataProviders = new ConfigurationProperty(null, typeof(DataProviderElementCollection), null, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsDefaultCollection); private static ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection(); #region 类型构造函数 static DataSystemElement() { _properties.Add(_name); _properties.Add(_currentProvider); _properties.Add(_dataProviders); _properties.Add(_dataModules); } #endregion #region 构造函数 public DataSystemElement() {} public DataSystemElement(string name) { this.Name = name; } public DataSystemElement(string name, string currentProvider) { this.Name = name; this.CurrentProviderName = currentProvider; } #endregion #region 公共属性 public string Name { get { return (string)base[_name]; } set { base[_name] = value; } } public String CurrentProviderName { get { return (string)this[_currentProvider]; } set { this[_currentProvider] = value; } } public DataModuleElementCollection DataModules { get { return (DataModuleElementCollection)base[_dataModules]; } } public DataProviderElementCollection DataProviders { get { return (DataProviderElementCollection)base[_dataProviders]; } } #endregion } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者