User370603270 posted
Hello Guys,
I've asp.net web API integrated with public ui web site
the website will have many concurrent users that submit applications , api pull this to database.
the API do a lot functions like :
Get Data
Update Data
Upload files
I'm trying to use Async operations ( specially in upload documents )
I edited all function to use await Task.Run()=>bla())) , like this :
if (Someconditions)
{
await Task.Run(() => Function1());
await Task.Run(() => Function2())
if (Someconditions)
await Task.Run(() => Function3())
if (Someconditions)
await Task.Run(() => CreateUpdateDocumentDetails)); // Uploading document
For document upload function , I'm very confused
Should I use await UploadDocumentAsync() , or Task.Run(()=>UploadDocumetSync) or Task.Run(()=>UploadDocumentAsync)
Also Does Task.Run(SyncFunc()) mean all above function runs
asynchronously without marked them as async and is it good practice?
Last questions what's the difference between this and making all functions (async / await)
Thanks