EntityFramework ToListAsync() does not work

.net async-await c# entity-framework-6

Question

I try to use the EF ToListAsync method. But nothing occurred; there was no timeout, no exception, simply running.

I'll use this code.

        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();
    }

The ToList method's initial sync call returns results right away. ToListAsync's second async call is still in progress with no outcome or error.

Any recommendations?

1
8
2/25/2014 2:42:39 PM

Accepted Answer

ZZZ_tmp
19
2/25/2014 2:51:11 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow