Hi everyone,
I'm creating some web apis which CRUD information of foods.
My data base is now a json file. And I have config like this in my appsettings.json :
{"Logging": {"IncludeScopes": false,"LogLevel": {"Default": "Verbose","System": "Information","Microsoft": "Information" } },"ApplicationSettings": {"VirtualFoodDataFile": "~/Resources/FoodsList.json" } }
And I also have a class :
namespace ApiLayer.Models { public class ApplicationSettings { /// <summary> /// Virtual path of file contains foods data. /// </summary> public string VirtualFoodDataFile { get; set; } } }
I wonder how I can transfer information from my appsettings.json to ApplicationSettings object in Startup.cs.
Because I want to load my foods data when my application starts.
Please show me how to do please ?
Thank you,
P/s : I just want to transfer information from json file to ApplicationSettings object, so, please show me how to do in Startup.cs.