I have read that I should only use Result
instead of await
when I am absolutely sure that an operation is completed. I am not really sure what happens underneath and would like to ask experienced programmers if this is a perfectly safe usage of await
/ Result
/ async
.
public static bool Success()
{
return 0 < Execute("DELETE FROM Table WHERE Id = 12").Result;
}
public static async Task<int> Execute(string sql)
{
using (var con = Connection)
{
con.Open();
return await con.ExecuteAsync(sql);
}
}