I have a web app (ASP .Net Core 1.1 MVC) which has some basic CRUD operations. The web app consumes a web API for all its operations.
The web app has some pages for editing, with basic textboxes and dropdown lists in them. Some of the dropdown lists contain static information - for example, there might be a lookup table with these values:
1. Daily
2. Weekly
3. Monthly
4. Yearly
The web API exposes an endpoint to retrieve these values. However, I obviously don't want to call this every time the user navigates to the Edit page. Since this is static data that will never change, I would like to read this lookup data from the API just once when the web app starts up. The thing is I'm not really sure where the best place to do this is. Should I put Main() in Program.cs, or in Startup() in Startup.cs? Or should it be done using DI (somehow... not sure how that would happen). is there some best practise for this scenario?
And then the next question is where should I store this data? Can I just create a static, global variable where I hold all lookup tables? This is data that applies to all users/sessions, so I thought a basic global key/value pair list would be fine? I can read this from my various controllers to populate the dropdown lists in the views?
Thanks... just wanna do this the right way. Any tips would be greatly appreciated.