public GetPagesRequest( Expression <Func <PageProperties, bool> > filter = null, Expression <Func <PageProperties, dynamic> > order = null, bool orderDescending = false, int?itemsCount = null, int startItemNumber = 1, PageLoadableChilds loadChilds = PageLoadableChilds.None, bool includeUnpublished = false, bool includePrivate = false) : base(filter, order, orderDescending, itemsCount, startItemNumber) { SetDefaultOrder(s => s.Title); LoadChilds = loadChilds; IncludeUnpublished = includeUnpublished; IncludePrivate = includePrivate; }
public GetPageRequest(Guid id, PageLoadableChilds loadChilds = PageLoadableChilds.All) { Id = id; LoadChilds = loadChilds; }
/// <summary> /// Fetches the child by given parameters. /// </summary> /// <param name="query">The query.</param> /// <param name="loadChilds">The load child.</param> /// <returns>Query with fetched children by given parameters.</returns> private static IQueryable <PageProperties> FetchPageChilds(IQueryable <PageProperties> query, PageLoadableChilds loadChilds) { if (loadChilds.HasFlag(PageLoadableChilds.LayoutRegion)) { query = query .Fetch(p => p.Layout) .ThenFetchMany(l => l.LayoutRegions) .ThenFetch(lr => lr.Region); } else if (loadChilds.HasFlag(PageLoadableChilds.Layout)) { query = query.Fetch(p => p.Layout); } if (loadChilds.HasFlag(PageLoadableChilds.Category)) { query = query.Fetch(p => p.Category); } if (loadChilds.HasFlag(PageLoadableChilds.Image)) { query = query.Fetch(p => p.Image); } if (loadChilds.HasFlag(PageLoadableChilds.Tags)) { query = query.FetchMany(p => p.PageTags).ThenFetch(pt => pt.Tag); } return(query); }
/// <summary> /// Fetches the child by given parameters. /// </summary> /// <param name="query">The query.</param> /// <param name="loadChilds">The load child.</param> /// <returns>Query with fetched children by given parameters.</returns> private static IQueryable<PageProperties> FetchPageChilds(IQueryable<PageProperties> query, PageLoadableChilds loadChilds) { if (loadChilds.HasFlag(PageLoadableChilds.LayoutRegion)) { query = query .Fetch(p => p.Layout) .ThenFetchMany(l => l.LayoutRegions) .ThenFetch(lr => lr.Region); } else if (loadChilds.HasFlag(PageLoadableChilds.Layout)) { query = query.Fetch(p => p.Layout); } if (loadChilds.HasFlag(PageLoadableChilds.Category)) { query = query.Fetch(p => p.Category); } if (loadChilds.HasFlag(PageLoadableChilds.Image)) { query = query.Fetch(p => p.Image); } if (loadChilds.HasFlag(PageLoadableChilds.Tags)) { query = query.FetchMany(p => p.PageTags).ThenFetch(pt => pt.Tag); } return query; }