Example #1
0
        protected override sealed EntityList DoGetAll(PagingInfo paging, EagerLoadOptions eagerLoad)
        {
            if (!PagingInfo.IsNullOrEmpty(paging)) { throw new NotSupportedException(); }

            DataProvider.EnsureStore();
            var items = DataProvider._memoryRows.Values.Select(v => DataProvider.FromRow(v));
            var list = this.CreateList(items, false);
            TreeHelper.MarkTreeFullLoaded(list);

            return list;
        }
Example #2
0
        /// <summary>
        /// 通过本地 Id 查找实体。
        /// </summary>
        /// <param name="id"></param>
        /// <param name="eagerLoad">需要贪婪加载的属性。</param>
        /// <returns></returns>
        protected override sealed Entity DoGetById(object id, EagerLoadOptions eagerLoad)
        {
            DataProvider.EnsureStore();

            var row = DataProvider._memoryRows.Values.FirstOrDefault(e => e.Id.Equals(id));
            if (row == null) return null;
            //if (row == null)
            //{
            //    //如果还没有加载,则主动加载所有实体,然后再找到其中的那个。
            //    row = this.GetAll().FirstOrDefault(e => e.Id.Equals(id));
            //    if (row == null) { throw new InvalidOperationException("没有找到对应 id 的实体,可能是还没有通过仓库获取该实体。"); }
            //}

            return DataProvider.FromRow(row);
        }
 public new $domainEntityName$List GetByIdList(object[] idList, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByIdList(idList, eagerLoad) as $domainEntityName$List;
 }
 public new $domainEntityName$List GetByParentIdList(object[] parentIdList, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByParentIdList(parentIdList, paging, eagerLoad) as $domainEntityName$List;
 }
 public new $domainEntityName$List GetAll(PagingInfo paging= null, EagerLoadOptions eagerLoad = null)
 {
     return base.GetAll(paging, eagerLoad) as $domainEntityName$List;
 }
 public new $domainEntityName$ GetById(object id, EagerLoadOptions eagerLoad = null)
 {
     return base.GetById(id, eagerLoad) as $domainEntityName$;
 }
 public new $domainEntityName$ GetFirst(EagerLoadOptions eagerLoad = null)
 {
     return base.GetFirst(eagerLoad) as $domainEntityName$;
 }
 public new $domainEntityName$List GetByTreePId(object treePId, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreePId(treePId, eagerLoad) as $domainEntityName$List;
 }
 public new $domainEntityName$List GetByTreeParentIndex(string treeIndex, EagerLoadOptions eagerLoad = null)
 {
     return base.GetByTreeParentIndex(treeIndex, eagerLoad) as $domainEntityName$List;
 }
Example #10
0
 /// <summary>
 /// 使用 sql 语句来查询实体。
 /// </summary>
 /// <param name="sql">sql 语句,返回的结果集的字段,需要保证与属性映射的字段名相同。</param>
 /// <param name="paging">分页信息。</param>
 /// <param name="eagerLoad">需要贪婪加载的属性。</param>
 /// <returns></returns>
 public EntityList QueryList(FormattedSql sql, PagingInfo paging = null, EagerLoadOptions eagerLoad = null)
 {
     var args = new SqlQueryArgs(sql);
     args.SetDataLoadOptions(paging, eagerLoad);
     return this.QueryList(args);
 }
Example #11
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 this.DataQueryer.QueryList(sql, paging, eagerLoad);
 }