示例#1
0
        public static Task <IEnumerable> AsEnumerableAsync(this IQueryable query)
        {
            IObjectQueryProvider provider = query.Provider as IObjectQueryProvider;

            if (provider == null)
            {
                return(Task.FromResult(query.Provider.Execute(query.Expression) as IEnumerable));
            }

            return(provider.ExecuteAsync(query.Expression).ContinueWith(x => x.Result as IEnumerable));
        }
示例#2
0
        public static Task <IEnumerable <T> > AsEnumerableAsync <T>(this IQueryable <T> query)
        {
            IObjectQueryProvider provider = query.Provider as IObjectQueryProvider;

            if (provider == null)
            {
                return(Task.FromResult(query.Provider.Execute <IEnumerable <T> >(query.Expression)));
            }

            return(provider.ExecuteAsync <IEnumerable <T> >(query.Expression));
        }