. Netcore~json instead of XML

Source: Internet
Author: User

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!

    1. Project.json
    2. Appsettings.json
    3. Bundleconfig.json
    4. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.