On my small project, I try to save some data or send notification to users.
Could I use await/async on my c# code and query run even after sending data to client ?
Here is the sample:
async string GetName(long userId)
{
string information=""; // loading data with entity
await Task.Run(() => UpdateActivity(userId));
await Task.Run(() => SendNotification(userId));
return information;
}
void UpdateActivity(long userId)
{
// loading data with entity
// updating activity
}
void SendNotification(long userId)
{
// loading data with entity
// Sending Notification
}
Here is one of my problem during loading data with entity
An exception of type 'System.Data.Entity.Core.EntityException' occurred in mscorlib.dll but was not handled in user code
Additional information: The underlying provider failed on Open.
Entity code, works fine when I haven't using await-async