Ejemplo n.º 1
0
 internal QueryableActionResult(IQueryable <TElement> innerQueryable,
                                QueryProjection projection,
                                int?defaultPageSize)
     : base(innerQueryable)
 {
     Projection      = projection;
     DefaultPageSize = defaultPageSize;
 }
Ejemplo n.º 2
0
 private static IQueryableActionResult WrapActionResult <TElement, TResult>(IQueryable <TElement> source,
                                                                            QueryProjection projection,
                                                                            int?defaultPageSize)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     return(new QueryableActionResult <TElement, TResult>(source, projection, defaultPageSize));
 }
Ejemplo n.º 3
0
 public static IQueryableActionResult <T> WrapActionResult <T>(this IQueryable <T> source,
                                                               QueryProjection projection = null,
                                                               int?defaultPageSize        = null)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     return((IQueryableActionResult <T>)WrapActionResult((IQueryable)source, projection, defaultPageSize));
 }
Ejemplo n.º 4
0
        public static object Execute(this IQueryable source, QueryProjection projection)
        {
            if (source == null)
                throw new ArgumentNullException(nameof(source));

            if (projection == null)
                throw new ArgumentNullException(nameof(projection));

            return projection.Execute(source);
        }
Ejemplo n.º 5
0
        public static IQueryableActionResult WrapActionResult(this IQueryable source,
                                                              QueryProjection projection = null,
                                                              int?defaultPageSize        = null)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            Type resultType;

            if (projection != null)
            {
                resultType = projection.GetResultType(source.ElementType);
            }
            else
            {
                projection = QueryProjection.AsEnumerable;
                resultType = source.ElementType;
            }
            return
                ((IQueryableActionResult)wrapActionResultGenericMethod.MakeGenericMethod(source.ElementType, resultType)
                 .Invoke(null, new object[] { source, projection, defaultPageSize }));
        }
Ejemplo n.º 6
0
 public virtual void AddSelector(QueryProjection <T, TResult> specification)
 {
     this.Selector = specification.ToSelectExpression();
 }
 public QueryWithProjectionBuilder <T, TResult> AddSelector(QueryProjection <T, TResult> specification)
 {
     this.query.AddSelector(specification);
     return(this);
 }
Ejemplo n.º 8
0
 public QueryBuilderOptions(IReadOnlyList <IncludeExpression> includes = null, QueryProjection projection = QueryProjection.Default)
 {
     Includes   = includes;
     Projection = projection;
 }