In the. Netcore era, the biggest change is the use of JSON more active, basically replace the previous XML, such as some user configuration, system configuration, package configuration, etc. are based on JSON, and Web. config This file basically become a puppet, like the Emperor of the Great Qing Dynasty The following uncle put a few major JSON files, and share with you this Empress Dowager Cixi!
- Project.json
- Appsettings.json
- Bundleconfig.json
- Configconstants.json (Lindcore environment configuration)
Project.json project configuration file
Major storage items for global configuration information, such as NuGet package dependencies,. Netcore versions, Web publishing related configurations, etc.
Appsettings.json user-defined configuration files
The main storage users in the project's personalized configuration, such as database connection string, log configuration, persistence, third-party payment related, in short, it took the content of the AppSetting node in Web. config.
Bundleconfig.json Front desk js/css packaging files
JS,CSS files such as the Web site need to be packaged in this file, and then the project can be automatically loaded after startup
Uncle Configconstants.json. Framework global configuration file
The Lindcore framework is primarily required for system-level configuration items such as logs, Redis connections, MongoDB connections, IOC containers, cache policies, message policies, and so on.
These JSON files can be injected in startup so that the configuration in the JSON file can be used in the program.
public Startup (ihostingenvironment env) { varnew Configurationbuilder () . Setbasepath (env. Contentrootpath) . Addjsonfile ("appsettings.json"truetrue) . Addenvironmentvariables (); = Builder. Build (); }
Through the above 4 large JSON files, the relevant people should be on this. Netcore the JSON configuration has an intuitive understanding, in future articles, we will also introduce the implementation of the relevant details.
Thank you for reading!
. Netcore~json instead of XML