I have created a appsettings.json file to store all constant information.
I am creating a .Net Core 2 console application, and need to access this through a global constant file.
What ever online resources I am seeing basically says how to access it in program.cs file only.
The appsettings.json Configuration can be inserted at any class using Dependency Injection
public class Test
{
public Test(IConfiguration configuration)
{
Configuration = configuration;
}
private readonly IConfiguration Configuration;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.