コード例 #1
0
ファイル: Query.cs プロジェクト: guojianbin/xcore
        private void queryChildObjects(int parentResultsCount, ArrayList results, IList oldParentsList, String _no_cached_Ids)
        {
            int icount = 0;

            foreach (EntityInfo info in _state.EntityInfo.ChildEntityList)
            {
                if (icount >= parentResultsCount)
                {
                    break;
                }


                ObjectInfo state = new ObjectInfo(info);
                IList      list  = ObjectDb.Find(state, String.Format("Id in ({0})", _no_cached_Ids)).select(_selectItems).list();

                for (int i = 0; i < list.Count; i++)
                {
                    IEntity objc = list[i] as IEntity;
                    // state
                    //objc.state = new ObjectInfo( objc.GetType() ).Copy( _state );
                    results.Add(objc);
                    oldParentsList.RemoveAt(getIndexOfObject(oldParentsList, objc));
                    ObjectPool.Add(objc);
                }

                if (list.Count > 0)
                {
                    icount += list.Count;
                }
            }
        }
コード例 #2
0
        public static Hashtable getEntityPropertyList(IList _includeEntityPropertyList, Hashtable _ep_ids, Hashtable selectColumn, String order)
        {
            Hashtable hashtable = new Hashtable();

            if (_includeEntityPropertyList == null)
            {
                return(hashtable);
            }

            foreach (EntityPropertyInfo info in _includeEntityPropertyList)
            {
                String   epIds  = "";
                String[] arrIds = new String[] { };
                if (_ep_ids[info.ColumnName] != null)
                {
                    arrIds = _ep_ids[info.ColumnName].ToString().Trim().TrimEnd(',').Split(',');
                }

                foreach (String strId in arrIds)
                {
                    IEntity cacheObj = ObjectPool.FindOne(info.EntityInfo.Type, cvt.ToInt(strId));
                    if (cacheObj != null)
                    {
                        hashtable[getPropertyObjectKey(info.Name, cacheObj.Id)] = cacheObj;
                    }
                    else
                    {
                        epIds = epIds + strId + ",";
                    }
                }
                epIds = epIds.TrimEnd(',');

                if (strUtil.IsNullOrEmpty(epIds))
                {
                    continue;
                }

                String col = selectColumn[info.Name].ToString().Trim().TrimEnd(',');
                if (string.Compare(col, "Id", true) != 0)
                {
                    if (!col.Equals("*") && (("," + col + ",").ToLower().IndexOf(",id,") < 0))
                    {
                        col = "Id," + col;
                    }

                    ObjectInfo cstate = new ObjectInfo(info.EntityInfo);
                    cstate.IsFindChild = true;
                    IList list = ObjectDb.Find(cstate, String.Format("Id in ({0})", epIds)).list();

                    foreach (IEntity objItem in list)
                    {
                        hashtable[getPropertyObjectKey(info.Name, objItem.Id)] = objItem;
                        ObjectPool.Add(objItem);
                    }
                }
            }

            return(hashtable);
        }