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");

     
  • 相关阅读:
    smb 共享文件夹
    php nginx 配置
    mysql 存储过程
    ubuntu 源码下载分析
    rust 小米R3G官方rom(openwrt) openssl
    rust 配置
    mac 制作树莓派3b启动盘
    小米R2D
    golang 配置
    golang pprof操作流程
  • 原文地址:https://www.cnblogs.com/xiang/p/583705.html
Copyright © 2011-2022 走看看