I am using asp.net MVC-5 with EF-6, and I am not sure if using await + ToListAsync
is valid. For example, I have the following repository method which returns an IQueryable :-
public IQueryable<TSet> getAllScanEmailTo()
{
return t.TSets.Where(a=>a.Name.StartsWith("ScanEmail"));
}
And I am calling it as follow:-
var emailsTo = await repository.getAllScanEmailTo().ToListAsync();
In the beginning, I thought I will get an error because I am using "await" a method which is not defined as a task, but the above worked well, so can anyone advice on this, please ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…