Hi.
I have a bunch of Static LookUp Table objects in order to serve the users across the application with shared data tables for look up purposes.
In order to have them available when any user logs into the application, where would be the proper place to load data in these static objects when the IIS starts the website for whatever reason?
Thanks.
Ivan
(Wisej 2.2.43.0 – C# – SQLServer)
Thank you Luca.
Will it run even before any user opens the application? I mean, I have set the website Application Pool to Start Mode = AlwaysRunning and it Recycles every day at 4:00AM. When it recycles, will it run the Program.cs Static constructor?
What I would like to do is to fill the LookUp Tables “cache” even before any user logs into the application, avoiding any delay to any of them. For sure, I will check if the Tables are already filled and take care of sync later…
You can use the static constructor of Program.cs. Static constructors are invoked the first time .NET loads a type.
static Program() {
}
Please login first to submit.