Ejemplo n.º 1
0
 public new MonthPlanList GetByIdList(object[] idList, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByIdList(idList, eagerLoad) as MonthPlanList;
 }
Ejemplo n.º 2
0
 public new Chapter GetById(object id, EagerLoadOptions eagerLoad = null)
 {
     return base.GetById(id, eagerLoad) as Chapter;
 }
Ejemplo n.º 3
0
 public new ChapterList GetByTreePId(object treePId, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreePId(treePId, eagerLoad) as ChapterList;
 }
Ejemplo n.º 4
0
 public new OperationACList GetAll(PagingInfo paging= null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetAll(paging, eagerLoad) as OperationACList;
 }
Ejemplo n.º 5
0
 public new OperationACList GetByTreeParentIndex(string treeIndex, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreeParentIndex(treeIndex, eagerLoad) as OperationACList;
 }
Ejemplo n.º 6
0
 public new ProductAttachement GetById(object id, EagerLoadOptions eagerLoad = null)
 {
     return base.GetById(id, eagerLoad) as ProductAttachement;
 }
Ejemplo n.º 7
0
 public new ProductAttachementList GetByTreePId(object treePId, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreePId(treePId, eagerLoad) as ProductAttachementList;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 通过 IQuery 对象来查询实体。
 /// </summary>
 /// <param name="query">查询对象。</param>
 /// <param name="paging">分页信息。</param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <param name="markTreeFullLoaded">如果某次查询结果是一棵完整的子树,那么必须设置此参数为 true ,才可以把整个树标记为完整加载。</param>
 /// <returns></returns>
 protected EntityList QueryList(IQuery query, PagingInfo paging = null, EagerLoadOptions eagerLoad = null, bool markTreeFullLoaded = false)
 {
     return(this.DataQueryer.QueryList(query, paging, eagerLoad, markTreeFullLoaded));
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 子类重写此方法来实现通过父 Id 列表来获取所有组合子对象的列表
        /// </summary>
        /// <param name="parentIdList">The parent identifier list.</param>
        /// <param name="paging">分页信息。</param>
        /// <param name="eagerLoad">需要贪婪加载的属性。</param>
        /// <returns></returns>
        public virtual EntityList GetByParentIdList(object[] parentIdList, PagingInfo paging, EagerLoadOptions eagerLoad)
        {
            var parentProperty = _repository.FindParentPropertyInfo(true);
            var mp             = (parentProperty.ManagedProperty as IRefEntityProperty).RefIdProperty;

            var table = qf.Table(_repository);
            var q     = qf.Query(
                table,
                where : qf.Constraint(table.Column(mp), PropertyOperator.In, parentIdList)
                );

            var list = this.QueryList(q, paging, eagerLoad, true);

            return(list);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 子类重写此方法来实现通过父 Id 列表来获取所有组合子对象的列表
        /// </summary>
        /// <param name="parentIdList">The parent identifier list.</param>
        /// <param name="paging">分页信息。</param>
        /// <param name="eagerLoad">需要贪婪加载的属性。</param>
        /// <returns></returns>
        public virtual EntityList GetByParentIdList(object[] parentIdList, PagingInfo paging, EagerLoadOptions eagerLoad)
        {
            var parentProperty = _repository.FindParentPropertyInfo(true);
            var mp             = (parentProperty.ManagedProperty as IRefEntityProperty).RefIdProperty;

            var table        = f.Table(_repository);
            var parentColumn = table.Column(mp);
            var q            = f.Query(
                table,
                where : f.Constraint(parentColumn, PropertyOperator.In, parentIdList),
                orderBy: new List <IOrderBy> {
                f.OrderBy(parentColumn)
            }
                //orderBy: _repository.SupportTree ? null : new List<IOrderBy> { f.OrderBy(parentColumn) }
                );

            var list = this.QueryList(q, paging, eagerLoad, true);

            return(list);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 通过 linq 来查询实体。
 /// </summary>
 /// <param name="queryable">linq 查询对象。</param>
 /// <param name="paging">分页信息。</param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 /// <exception cref="System.InvalidProgramException"></exception>
 protected EntityList QueryList(IQueryable queryable, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return(this.DataQueryer.QueryList(queryable, paging, eagerLoad));
 }
Ejemplo n.º 12
0
 EntityList IRepositoryDataQueryAPI.QueryList(FormattedSql sql, PagingInfo paging, EagerLoadOptions eagerLoad)
 {
     return(this.QueryList(sql, paging, eagerLoad));
 }
Ejemplo n.º 13
0
 EntityList IRepositoryDataQueryAPI.QueryList(IQuery query, PagingInfo paging, EagerLoadOptions eagerLoad, bool markTreeFullLoaded)
 {
     return(this.QueryList(query, paging, eagerLoad, markTreeFullLoaded));
 }
Ejemplo n.º 14
0
 EntityList IRepositoryDataQueryAPI.QueryList(IQueryable queryable, PagingInfo paging, EagerLoadOptions eagerLoad)
 {
     return(this.QueryList(queryable, paging, eagerLoad));
 }
Ejemplo n.º 15
0
 public new MonthPlanList GetByTreeParentIndex(string treeIndex, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreeParentIndex(treeIndex, eagerLoad) as MonthPlanList;
 }
Ejemplo n.º 16
0
        /// <summary>
        /// <see cref="ODataQueryCriteria"/> 查询的数据层实现。
        /// </summary>
        /// <param name="criteria"></param>
        public virtual EntityList GetBy(ODataQueryCriteria criteria)
        {
            var f = QueryFactory.Instance;
            var t = f.Table(this.Repository, "T0");

            var q = f.Query(from: t);

            var properties = this.Repository.EntityMeta.ManagedProperties.GetCompiledProperties();

            #region Filter

            if (!string.IsNullOrWhiteSpace(criteria.Filter))
            {
                var parser = new ODataFilterParser
                {
                    _properties = properties
                };
                parser.Parse(criteria.Filter, q);
            }

            #endregion

            #region OrderBy

            if (!string.IsNullOrWhiteSpace(criteria.OrderBy))
            {
                var orderByProperties = criteria.OrderBy.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var orderByExp in orderByProperties)
                {
                    var values   = orderByExp.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    var property = values[0];
                    var orderBy  = properties.Find(property, true);
                    if (orderBy != null)
                    {
                        var dir = values.Length == 1 || values[1].ToLower() == "asc" ? OrderDirection.Ascending : OrderDirection.Descending;
                        q.OrderBy.Add(f.OrderBy(t.Column(orderBy), dir));
                    }
                }
            }

            #endregion

            #region Expand

            if (!string.IsNullOrWhiteSpace(criteria.Expand))
            {
                var eagerLoad = new EagerLoadOptions();

                var expandProperties = criteria.Expand.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                var splitter         = new char[] { '.' };
                foreach (var expand in expandProperties)
                {
                    //如果有'.',表示类似于 Section.Chapter.Book 这种表达式。
                    if (expand.Contains('.'))
                    {
                        Type nextEntityType = null;//下一个需要使用的实体类型

                        var cascadeProperties = expand.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
                        foreach (var property in cascadeProperties)
                        {
                            var container = properties;
                            if (nextEntityType != null)
                            {
                                var meta = CommonModel.Entities.Find(nextEntityType);
                                container = meta.ManagedProperties.GetCompiledProperties();
                            }

                            var mp = container.Find(property, true);
                            if (mp != null)
                            {
                                var refProperty = mp as IRefEntityProperty;
                                if (refProperty != null)
                                {
                                    eagerLoad.LoadWith(refProperty);
                                    nextEntityType = refProperty.RefEntityType;
                                }
                                else if (mp is IListProperty)
                                {
                                    eagerLoad.LoadWith(mp as IListProperty);
                                    nextEntityType = (mp as IListProperty).ListEntityType;
                                }
                            }
                        }
                    }
                    else
                    {
                        var mp = properties.Find(expand, true);
                        if (mp != null)
                        {
                            if (mp is IListProperty)
                            {
                                eagerLoad.LoadWith(mp as IListProperty);
                            }
                            else if (mp is IRefEntityProperty)
                            {
                                eagerLoad.LoadWith(mp as IRefEntityProperty);
                            }
                        }
                        else if (expand == EntityConvention.TreeChildrenPropertyName)
                        {
                            eagerLoad.LoadWithTreeChildren();
                        }
                    }

                    criteria.EagerLoad = eagerLoad;
                }
            }

            #endregion

            return(this.QueryList(q, criteria.PagingInfo, criteria.EagerLoad));
        }
Ejemplo n.º 17
0
 public new MonthPlan GetFirst(EagerLoadOptions eagerLoad = null)
 {
     return base.GetFirst(eagerLoad) as MonthPlan;
 }
Ejemplo n.º 18
0
        /// <summary>
        /// 从持久层中查询数据。
        /// 本方法只能由仓库中的方法来调用。本方法的返回值的类型将与仓库中方法的返回值保持一致。
        /// 支持的返回值:EntityList、Entity、int、LiteDataTable。
        /// </summary>
        /// <param name="queryable"></param>
        /// <param name="paging"></param>
        /// <param name="eagerLoad"></param>
        /// <returns></returns>
        public object QueryData(IQueryable queryable, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
        {
            var query = ConvertToQuery(queryable);

            return(this.QueryData(query, paging, eagerLoad));
        }
Ejemplo n.º 19
0
 public new ProductAttachementList GetByParentIdList(object[] parentIdList, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByParentIdList(parentIdList, paging, eagerLoad) as ProductAttachementList;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 分页查询所有的实体类
 /// </summary>
 /// <param name="paging">分页信息。</param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public EntityList GetAll(PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return(this.DoGetAll(paging, eagerLoad));
 }
Ejemplo n.º 21
0
        internal void SetDataLoadOptions(PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
        {
            if (!PagingInfo.IsNullOrEmpty(paging))
            {
                this.PagingInfo = paging;
            }

            if (eagerLoad != null && eagerLoad.CoreList.Count > 0)
            {
                if (this.EagerLoadOptions != null)
                {
                    for (int i = 0, c = eagerLoad.CoreList.Count; i < c; i++)
                    {
                        var item = eagerLoad.CoreList[i];
                        this.EagerLoad(item);
                    }
                }
                else
                {
                    this.EagerLoadOptions = eagerLoad;
                }
            }
        }
Ejemplo n.º 22
0
 /// <summary>
 /// 查询第一个实体。
 /// </summary>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public Entity GetFirst(EagerLoadOptions eagerLoad = null)
 {
     return(this.DoGetFirst(eagerLoad));
 }
Ejemplo n.º 23
0
 public new OperationACList GetByIdList(object[] idList, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByIdList(idList, eagerLoad) as OperationACList;
 }
Ejemplo n.º 24
0
 /// <summary>
 /// 通过Id在数据层中查询指定的对象
 /// </summary>
 /// <param name="id">The unique identifier.</param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public Entity GetById(object id, EagerLoadOptions eagerLoad = null)
 {
     return(this.DoGetById(id, eagerLoad));
 }
Ejemplo n.º 25
0
 public new OperationAC GetFirst(EagerLoadOptions eagerLoad = null)
 {
     return base.GetFirst(eagerLoad) as OperationAC;
 }
Ejemplo n.º 26
0
 /// <summary>
 /// 获取指定 id 集合的实体列表。
 /// </summary>
 /// <param name="idList"></param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public EntityList GetByIdList(object[] idList, EagerLoadOptions eagerLoad = null)
 {
     return(this.DoGetByIdList(idList, eagerLoad));
 }
Ejemplo n.º 27
0
 public new ChapterList GetByParentIdList(object[] parentIdList, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByParentIdList(parentIdList, paging, eagerLoad) as ChapterList;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// 通过父对象 Id 分页查询子对象的集合。
 /// </summary>
 /// <param name="parentId"></param>
 /// <param name="paging">分页信息。</param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public EntityList GetByParentId(object parentId, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return(this.DoGetByParentId(parentId, paging, eagerLoad));
 }
Ejemplo n.º 29
0
        /// <summary>
        /// 通过 linq 来查询实体。
        /// </summary>
        /// <param name="queryable">linq 查询对象。</param>
        /// <param name="paging">分页信息。</param>
        /// <param name="eagerLoad">需要贪婪加载的属性。</param>
        /// <returns></returns>
        /// <exception cref="System.InvalidProgramException"></exception>
        protected EntityList QueryList(IQueryable queryable, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
        {
            var query = ConvertToQuery(queryable);

            return(this.QueryList(query, paging, eagerLoad));
        }
Ejemplo n.º 30
0
 /// <summary>
 /// 获取指定索引对应的树节点的所有父节点。
 /// 查询出的父节点同样以一个部分树的形式返回。
 /// </summary>
 /// <param name="treeIndex"></param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public EntityList GetAllTreeParents(string treeIndex, EagerLoadOptions eagerLoad = null)
 {
     return(this.DoGetAllTreeParents(treeIndex, eagerLoad));
 }
Ejemplo n.º 31
0
 public new MonthPlanList GetByParentId(object parentId, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByParentId(parentId, paging, eagerLoad) as MonthPlanList;
 }
Ejemplo n.º 32
0
 /// <summary>
 /// 查找指定树节点的直接子节点。
 /// </summary>
 /// <param name="treePId">需要查找的树节点的Id.</param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public EntityList GetByTreePId(object treePId, EagerLoadOptions eagerLoad = null)
 {
     return(this.DoGetByTreePId(treePId, eagerLoad));
 }
Ejemplo n.º 33
0
 public new MonthPlanList GetByTreePId(object treePId, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreePId(treePId, eagerLoad) as MonthPlanList;
 }
Ejemplo n.º 34
0
 /// <summary>
 /// 查询所有的根节点。
 /// </summary>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public EntityList GetTreeRoots(EagerLoadOptions eagerLoad = null)
 {
     return(this.DoGetTreeRoots(eagerLoad));
 }
Ejemplo n.º 35
0
 public new ProductAttachementList GetAll(PagingInfo paging= null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetAll(paging, eagerLoad) as ProductAttachementList;
 }
Ejemplo n.º 36
0
 protected virtual EntityList DoGetAll(PagingInfo paging, EagerLoadOptions eagerLoad)
 {
     return((EntityList)_dataProvider.GetAll(paging, eagerLoad));
 }
Ejemplo n.º 37
0
 public new ProductAttachementList GetByIdList(object[] idList, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByIdList(idList, eagerLoad) as ProductAttachementList;
 }
Ejemplo n.º 38
0
 protected virtual Entity DoGetFirst(EagerLoadOptions eagerLoad)
 {
     return((Entity)_dataProvider.GetAll(null, eagerLoad));
 }
Ejemplo n.º 39
0
 public new ProductAttachementList GetByTreeParentIndex(string treeIndex, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreeParentIndex(treeIndex, eagerLoad) as ProductAttachementList;
 }
Ejemplo n.º 40
0
 protected virtual Entity DoGetById(object id, EagerLoadOptions eagerLoad)
 {
     return(_dataProvider.GetById(id, eagerLoad));
 }
Ejemplo n.º 41
0
 public new ProductAttachement GetFirst(EagerLoadOptions eagerLoad = null)
 {
     return base.GetFirst(eagerLoad) as ProductAttachement;
 }
Ejemplo n.º 42
0
 protected virtual EntityList DoGetTreeRoots(EagerLoadOptions eagerLoad)
 {
     return((EntityList)_dataProvider.GetTreeRoots(eagerLoad));
 }
Ejemplo n.º 43
0
        /// <summary>
        /// 贪婪加载某个属性
        /// </summary>
        /// <param name="property">需要贪婪加载的托管属性。可以是一个引用属性,也可以是一个组合子属性。</param>
        private void EagerLoad(ConcreteProperty property)
        {
            if (this.EagerLoadOptions == null)
            {
                this.EagerLoadOptions = new EagerLoadOptions();
            }

            this.EagerLoadOptions.CoreList.Add(property);
        }
Ejemplo n.º 44
0
 protected virtual EntityList DoGetByIdList(object[] idList, EagerLoadOptions eagerLoad)
 {
     return(_dataProvider.GetByIdList(idList, eagerLoad));
 }
Ejemplo n.º 45
0
 public new OperationAC GetById(object id, EagerLoadOptions eagerLoad = null)
 {
     return base.GetById(id, eagerLoad) as OperationAC;
 }
Ejemplo n.º 46
0
 protected virtual EntityList DoGetByParentIdList(object[] parentIdList, PagingInfo paging, EagerLoadOptions eagerLoad)
 {
     return(_dataProvider.GetByParentIdList(parentIdList, paging, eagerLoad));
 }
Ejemplo n.º 47
0
 public new OperationACList GetByParentId(object parentId, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByParentId(parentId, paging, eagerLoad) as OperationACList;
 }
Ejemplo n.º 48
0
 protected virtual EntityList DoGetByParentId(object parentId, PagingInfo paging, EagerLoadOptions eagerLoad)
 {
     return((EntityList)_dataProvider.GetByParentId(parentId, paging, eagerLoad));
 }
Ejemplo n.º 49
0
 public new OperationACList GetByTreePId(object treePId, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreePId(treePId, eagerLoad) as OperationACList;
 }
Ejemplo n.º 50
0
 protected virtual EntityList DoGetByTreePId(object treePId, EagerLoadOptions eagerLoad)
 {
     return(_dataProvider.GetByTreePId(treePId, eagerLoad));
 }
Ejemplo n.º 51
0
 public new ChapterList GetAll(PagingInfo paging= null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetAll(paging, eagerLoad) as ChapterList;
 }
Ejemplo n.º 52
0
 protected virtual EntityList DoGetAllTreeParents(string treeIndex, EagerLoadOptions eagerLoad)
 {
     return(_dataProvider.GetAllTreeParents(treeIndex, eagerLoad));
 }
Ejemplo n.º 53
0
 public new ChapterList GetByIdList(object[] idList, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByIdList(idList, eagerLoad) as ChapterList;
 }
Ejemplo n.º 54
0
 public new MonthPlanList GetAll(PagingInfo paging= null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetAll(paging, eagerLoad) as MonthPlanList;
 }
Ejemplo n.º 55
0
 public new ChapterList GetByTreeParentIndex(string treeIndex, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreeParentIndex(treeIndex, eagerLoad) as ChapterList;
 }
Ejemplo n.º 56
0
 public new MonthPlan GetById(object id, EagerLoadOptions eagerLoad = null)
 {
     return base.GetById(id, eagerLoad) as MonthPlan;
 }
Ejemplo n.º 57
0
 public new Chapter GetFirst(EagerLoadOptions eagerLoad = null)
 {
     return base.GetFirst(eagerLoad) as Chapter;
 }
Ejemplo n.º 58
0
 /// <summary>
 /// 使用 sql 语句来查询实体。
 /// </summary>
 /// <param name="sql">sql 语句,返回的结果集的字段,需要保证与属性映射的字段名相同。</param>
 /// <param name="paging">分页信息。</param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 protected EntityList QueryList(FormattedSql sql, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return(Queryer.QueryList(sql, paging, eagerLoad));
 }