Ejemplo n.º 1
0
        private static IList findAllFromChild(IList parents, ObjectInfo state)
        {
            ArrayList results = new ArrayList();

            foreach (EntityInfo info in state.EntityInfo.ChildEntityList)
            {
                ObjectInfo childState = new ObjectInfo(info);
                childState.includeAll();
                IList children = ObjectDb.FindAll(childState);

                for (int i = 0; i < children.Count; i++)
                {
                    IEntity child = children[i] as IEntity;
                    // state
                    //child.state.Order = state.Order;
                    results.Add(child);
                    parents.RemoveAt(Query.getIndexOfObject(parents, child));
                }
            }

            if (parents.Count > 0)
            {
                results.AddRange(parents);
            }
            results.Sort();

            return(results);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查询 T 类型对象的所有数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static List <T> findAll <T>() where T : IEntity
        {
            ObjectInfo state = new ObjectInfo(typeof(T));

            state.includeAll();
            IList objList = ObjectPool.FindAll(typeof(T));

            if (objList == null)
            {
                objList = ObjectDb.FindAll(state);
                ObjectPool.AddAll(typeof(T), objList);
            }

            return(getResults <T>(objList));
        }