zoukankan      html  css  js  c++  java
  • web.config 研究

    一、将配置映射成类

    1、配置中增加

        <configSections>
            <section name="appConfiguration" type="OilDigital.CGGL.AppConfig.AppConfigurationHandler,OilDigital.CGGL.AppConfig,Culture=neutral, PublicKeyToken=null" />
            
        </configSections>
    <appConfiguration>
            <EnterPriseName>中石油</EnterPriseName>
    </appConfiguration>

    2、类

    public class AppConfiguration:System.Configuration.ConfigurationSection
        {
            public AppConfiguration()
            {
                
            }
    
            /// <summary>
            /// 企业名称
            /// </summary>
            [ConfigurationProperty("EnterPriseName", DefaultValue = "工程建设公司")]
            public string  EnterPriseName
            {
                get { return (string)this["EnterPriseName"]; }
                set { this["EnterPriseName"] = value; }
            }
    }

    3、使用

    AppConfiguration config =(AppConfiguration)System.Configuration.ConfigurationManager.GetSection("appConfiguration");
  • 相关阅读:
    TensorFlow学习笔记--CIFAR-10 图像识别
    第二章--第二节:注释
    webbrowser
    RichViewEdit
    RichEdit
    TreeView
    RichView
    ListView
    DesktopLoader服务程序
    Delphi实现程序只运行一次并激活已打开的程序
  • 原文地址:https://www.cnblogs.com/zhengwei-cq/p/11760486.html
Copyright © 2011-2022 走看看