zoukankan      html  css  js  c++  java
  • 配置节处理程序声明

    <configSections>
    <section name="ApplicationConfiguration" type="Duwamish7.SystemFramework.ApplicationConfiguration, Duwamish7.SystemFramework" />
    <section name="DuwamishConfiguration" type="Duwamish7.Common.DuwamishConfiguration, Duwamish7.Common" />
    </configSections>

             配置节处理程序声明(Section),必须出现在配置文件顶部 <configSections> 和 </configSections> 标记之间,在这里,它们只用到了name和type属性,其中,name属性定义了指定配置节的名称,而type属性则规定了指定从配置文件中读取节的配置节处理程序类的名称,有两个部分,前面为处理程序的类名,后面为Assembly名(Assembly必须位于bin目录中)以及版本号,公匙等信息

            按照上述配置节信息可以知道:Duwamish7.SystemFramework.ApplicationConfiguration和Duwamish7.Common.DuwamishConfiguration,他们分别位于SystemFramework和Common项目中

           .net规定,所有能够处理配置节的类必须要实现IConfigurationSectionHandler接口,而IConfigurationSectionHandler接口很简单,只有一个object Create(object parent,object configContext,XmlNode section)方法,这个方法不需要主动调用,它是在ConfigurationSettings.GetConfig这个静态方法的时候自动调用的,也就是说,当你在程序中使用ConfigurationSettings.GetConfig来获取配置节的时候,.net会根据改配置节声明中所定义的类名和路径自动实例化配置节处理类,并调用Create方法

           
    使用:System.Configuration.ConfigurationSettings.GetConfig("ApplicationConfiguration");

     
  • 相关阅读:
    Spring AOP 注解开发
    AOP的专业术语
    Java自定义注解的实现和应用
    Spring 声明式事务管理
    另一种线程安全机制:在事务管理中起到巨大作用的 ThreadLocal
    MySQL的二级索引
    数据库的范式化和反范式化
    MySQL为表字段添加索引
    mysql索引(二)----如何高效使用索引
    Alexnet网络
  • 原文地址:https://www.cnblogs.com/xiang/p/583705.html
Copyright © 2011-2022 走看看