How to load appsetting.json section into Dictionary in .NET Core?

后端 未结 10 1484
误落风尘
误落风尘 2020-12-05 16:49

I am familiar w/ loading an appsettings.json section into a strongly typed object in .NET Core startup.cs. For example:

public class CustomSection 
{
   publ         


        
10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-05 17:23

    You can use Configuration.Bind(settings); in startup.cs class

    And your settings class will be like

    public class AppSettings
    {
        public Dictionary MobileConfigInfo
        {
            get;
            set;
        }
    }
    

    Hope it helps!

提交回复
热议问题