Hi @Saeed Pooladzadeh ,
I couldn't understand your requirement clearly. Do you mean you want to know a wrapper which could get asp.net core configuration(Like appsettings )?
If this is your requirement , I suggest you could consider using the IConfiguration interface inside each controller or class. The asp.net core will register the Configuration service by default.
You could directly use it inside the controller or other service class.
More details about how to use it, you could refer to below codes and this article.
public class TestModel : PageModel
{
// requires using Microsoft.Extensions.Configuration;
private readonly IConfiguration Configuration;
public TestModel(IConfiguration configuration)
{
Configuration = configuration;
}
public ContentResult OnGet()
{
var myKeyValue = Configuration["MyKey"];
var title = Configuration["Position:Title"];
var name = Configuration["Position:Name"];
var defaultLogLevel = Configuration["Logging:LogLevel:Default"];
return Content($"MyKey value: {myKeyValue} \n" +
$"Title: {title} \n" +
$"Name: {name} \n" +
$"Default Log Level: {defaultLogLevel}");
}
}