public virtual IEnumerable <T> Get(Expression <Func <T, bool> > @where, int page = 1, int count = int.MaxValue) { var query = EntitySet <T> .Where(where).OrderBy(x => x.Id); query = _eventPublisherService.Filter(query); if (typeof(T).IsAssignableTo(typeof(IStoreEntity))) { return(query.SelectNested(page, count)); } return(query.Select(page, count)); }
public override Catalog Get(int id) { var query = _eventPublisherService.Filter(Repository.Where(x => x.Id == id)); return(query.SelectNested() .FirstOrDefault()); }
IEntitySet <ContentPage> WithRelations(IEntitySet <ContentPage> query) { return(_eventPublisherService.Filter(query.Join <SeoMeta>("Id", "EntityId", additionalExpression: (page, meta) => meta.EntityName == "ContentPage") .Join <User>("UserId", "Id", SourceColumn.Parent) .Relate(RelationTypes.OneToOne <ContentPage, SeoMeta>()) .Relate(RelationTypes.OneToOne <ContentPage, User>()))); }
private IEntitySet <Menu> GetByWhere(Expression <Func <Menu, bool> > @where) { Expression <Func <MenuItem, object> > orderBy = x => x.DisplayOrder; return(_eventPublisherService.Filter(Repository .Join <MenuItem>("Id", "MenuId", joinType: JoinType.LeftOuter) .Join <SeoMeta>("SeoMetaId", "Id", joinType: JoinType.LeftOuter) .Relate(RelationTypes.OneToMany <Menu, MenuItem>()) .Relate <SeoMeta>((menu, meta) => { var menuItems = menu.MenuItems.Where(x => x.SeoMetaId == meta.Id); foreach (var menuItem in menuItems) { menuItem.SeoMeta = meta; } }) .Where(where) .OrderBy(orderBy, RowOrder.Ascending))); }