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

Saeed Pooladzadeh 231 Reputation points
2021-09-25T04:21:24.47+00:00

Hello,

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?

thanks,

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,390 questions
C#
C#
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.
10,249 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Brando Zhang-MSFT 2,956 Reputation points Microsoft Vendor
    2021-09-28T01:20:21.24+00:00

    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}");  
        }  
    }  
    
    0 comments No comments