I have appsettings.json file where I want to declare paths to files.
"Paths": {
"file": "C:/file.pdf"
}
I want to access this value in my service, I try it to do like this:
public class ValueService: IValueService
{
IConfiguration Configuration { get; set; }
public MapsService(IConfiguration configuration)
{
this.Configuration = configuration;
}
public string generateFile()
{
var path = Configuration["Paths:file"] ;
}
}
however I get null values for var path
Startup.cs file has appsettings.json declared as it takes connection string from there. Is it possible to access these values outside startup.cs class?