I have an Async method in C# that is calling SQL function which is returning true or false and method is returning bool variable that is true or false.
This is my method:
public async Task<bool> Canlog(string userName, string pass
{
Context context = new Context();
bool queryResult = false;
using (context )
{
using (context .Database.Connection)
{
context .Database.Connection.Open();
string sqlStatment = .....
queryResult = authorizationContext.Database
.SqlQuery<bool>(sqlStatment)
.Single();
}
}
return await queryResult;
}
when I try this, I am getting error in this line return await queryResult that cannot await bool.
queryResult
is just abool
variable. There is nothing async there. And I also can't see any entity framework there... – Florian