. NetCore ~ Json replaces Xml,. netcorejsonxml

Source: Internet
Author: User

. NetCore ~ Json replaces Xml,. netcorejsonxml

In progress. in the era of netCore, the biggest change is that the use of Json is more active, basically replacing the previous XML, such as some user configurations, system configurations, and bag configurations are based on json, web. the config file is basically a zombie, just like the emperor of the Qing dynasty! Next, let's talk about several major json files and share with you the Empress Dowager Cixi!

Project. json project configuration file

It stores global configuration information of projects, such as nuget package dependencies,. netCore versions, and website release configurations.

Appsettings. json custom configuration file

It mainly stores users' personalized configurations in projects, such as database connection strings, log configurations, persistence methods, and third-party payment. In short, it takes out the contents of the deleetting node in web. config.

Bundleconfig. json front-end js/css package file

Package the js, css, and other files required by the website in this file, and then automatically load the files after the project is started.

ConfigConstants. json uncle framework global configuration file

It mainly includes system-level configuration items required by the linkcore framework, 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 content in the json file can be used in the program.

      public Startup(IHostingEnvironment env)        {            var builder = new ConfigurationBuilder()                .SetBasePath(env.ContentRootPath)                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)                .AddEnvironmentVariables();            Configuration = builder.Build();        }

Through the above four large json files, you should have an intuitive understanding of the Json configuration advocated by netCore. In future articles, we will also introduce the implementation of relevant details.

Thank you for reading this article!

 

Related Article

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.