I'm building a Visual Studio .NET application in c# with 2 databases and Entity Framework. At first, I thought it would be better to load the most used datas in static Lists when the app is launched, but it was a bit too long, so now I try to use Tasks. I have one method per table I want to load, and I call them in a more general method :
public static void fillConstantes()
{
new Task(FillFiches).Start();
new Task(FillCustomers).Start();
new Task(FillEmployees).Start();
new Task(FillContact1).Start();
new Task(FillServiceItems).Start();
new Task(FillServiceLine).Start();
}
The fact is, if if I try to access the datas in another class and the task isn't finished, it crashes, obvisouly. So, I was wondering if there's a good way to check if the tasks are done, are if I just have to check if it worked whenever I try to retrieve datas ?
Thanks for your help !