need help on how to set up the configration manager for a instagram app

Saeed Pooladzadeh 181 Reputation points


Does anyone have any info on how should be the configuration manager on a C# wrapper?

For example in a wrapper like instagramApiSharp or instaSharper?

How to set up it?


A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
984 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,214 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Brando Zhang-MSFT 2,086 Reputation points Microsoft Vendor

    Hi @Saeed Pooladzadeh ,

    I couldn't understand your requirement clearly. Do you mean you want to know a wrapper which could get core configuration(Like appsettings )?

    If this is your requirement , I suggest you could consider using the IConfiguration interface inside each controller or class. The 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}");  
    0 comments No comments