Dear,
Purpose of TPL is simply that you assign your piece of code to task scheduler, so that there is parallel process. In your case, you have different calls to DB, so its better to use TPL. But reason you mentioned of using task (Reason for wanting to use tasks is that I want to be able to monitor each load method to make sure it loaded correctly) is totally not purpose of TPL.
if you want to use status message of loading and loaded, you can get this easily using Task continuation (Please look Task Continuation in below link given).
But as your requirement given above, load table 1, then load table 2, then load table 3...., It means you are depending one task with other, In other words, your second task will wait, until first one execute successfully. Personally I don't recommend this approach. Use TPL with full advantage, Let your program to process all 10 methods independently.
to learn more about TPL 4.0, I would recommend you one of the best Article
Task Parallel Library: 1 of n[
^]
Any way Below is sample code for your, both Synchronize call and asynchronise call.
Task.Factory.StartNew(() =>
{
Console.WriteLine("Loading Table1 .... ");
}).ContinueWith(res =>
{
Console.WriteLine("Table1 loaded .... ");
}).ContinueWith(res =>
{
Console.WriteLine("Loading Table 2 ...");
}).ContinueWith(res =>
{
Console.WriteLine("Table2 loaded .... ");
});
Task t1 = Task.Factory.StartNew(() =>
{
Console.WriteLine("Loading Table1 .... ");
}).ContinueWith(res =>
{
Console.WriteLine("Table1 loaded .... ");
});
Task t2 = Task.Factory.StartNew(() =>
{
Console.WriteLine("Loading Table2 .... ");
}).ContinueWith(res =>
{
Console.WriteLine("Table2 loaded .... ");
});
Task t3 = Task.Factory.StartNew(() =>
{
Console.WriteLine("Loading Table3 .... ");
}).ContinueWith(res =>
{
Console.WriteLine("Table3 loaded .... ");
});
Task.WaitAll(t1, t2, t3);