I am working in ASP.Net 4.0 MVC project, where i am calling different APIs in Different threads at a same time. I am using Task.Factory.StartNew() for this purpose which has event .ContinueWith(), will run on completion of each threads.
My Query is how will i populate data coming at different times (as APIs are taking different time), in View (Guess it has some ajax involved). Currently I am waiting for all the thread to complete and then at last populating all the result at the end.
Need some Guidance to proceed to save some time.
You can't update the view after your action has returned by using the MVC framework only. What you can do
await Task.WhenAll) - this will save you one thread(the one which handles the request and you're currently blocking) but the user experience will be the same - he'll have to wait for all to see the complete view