我尝试调用EF方法ToListAsync.但没有任何事情发生 - 没有例外,没有超时只是运行.
这是我的代码.
private IQueryable<Place> placeCompleteQuery;
protected IQueryable<Place> PlaceCompleteQuery
{
get
{
return this.placeCompleteQuery ?? (this.placeCompleteQuery = this.Context.Places.Include(p => p.Address).
Include(p => p.CreatedBy).
Include(p => p.Source).
Include(p => p.Type.Translations).
Include(p => p.Ratings));
}
}
public async Task<IList<Place>> GetPlacesByLocationAsync(DbGeography location, int radius)
{
List<Place> temporaryResult = PlaceCompleteQuery.Where(p => p.Location.Distance(location) <= radius).
ToList();
return await PlaceCompleteQuery.Where(p => p.Location.Distance(location) <= radius).
ToListAsync();
}
Run Code Online (Sandbox Code Playgroud)
ToList方法的第一次同步调用立即返回结果.ToListAsync的第二次异步调用仍在运行,没有结果也没有异常.
有什么建议?