Git Product home page Git Product logo

appsettings.net's Introduction

AppSettings.NET

提供对自定义应用程序配置文件的访问(支持深层节点)

1、必须在配置文件Web.config中的节点AppSettings添加自定义配置的物理路径,key="AppSettingsPath"。

2、自定义配置文件必须是以AppSettings节点开始。例如:
<?xml version="1.0"?>
<appSettings>
 <add key="name" value="zhangsan" />
 <Person Name="张三" Age="18" Height="185" />
 <Orders>
  <Order>
   <Amount>15</Amount>
   <Name>理财卷</Name>
   <Code>SFR324234</Code>
  </Order>
  <Order Amount="17.00" Name="鼠标" Code="SFR544333" />
 </Orders>
</appSettings>

3、同时确保自定义配置文件设置了对应的读取权限。

使用方法:

1、键值:AppSettingClient.AppSettings["name"]
2、属性值:AppSettingClient.AttributesValue("Person", "Name")
3、实体:AppSettingClient<Person>.Load()
3、实体集合:AppSettingClient<List<Order>.Load("Orders")。(需要传入路径Orders)

缓存补充说明:

1、如果需要把配置信息加载在缓存中,可以设置:AppSettingConfig.IsCacheConfig=true
2、缓存已添加对文件的依赖,配置文件内容更新时会清空缓存,下次读取时自动初始化。
3、如果是http远程配置文件,默认会启动配置文件的扫描,有变更时,会使缓存失效,下次读取时自动初始化。
 扫描间隔可以设置:AppSettingConfig.ScanInterval 以秒为单位,默认间隔为5分钟。

appsettings.net's People

Contributors

wenjm avatar

Stargazers

well.james avatar jian玄冰 avatar

Watchers

James Cloos avatar  avatar

Forkers

kouweizhong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.