예제 #1
0
        public static QueryResult <TResult> ToDataResult <TSource, TResult>(this IQueryable <TSource> query, Action <QueryOptionsBuilder <TSource, TResult> > config)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var dataQuery = new QueryOptions <TSource, TResult>();
            var builder   = new QueryOptionsBuilder <TSource, TResult>(dataQuery);

            config(builder);

            return(ToDataResult(query, dataQuery));
        }
예제 #2
0
        public static QueryResult <T> ToDataResult <T>(this IQueryable <T> query, QueryRequest request)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var dataQuery = new QueryOptions <T, T>();
            var builder   = new QueryOptionsBuilder <T, T>(dataQuery);

            builder
            .Request(request)
            .Selector(t => t);

            return(ToDataResult(query, dataQuery));
        }