Exemplo n.º 1
0
        //------------------------------------------------------------------------------


        private static void ResolveOneType(MappingClass map, Type t)
        {
            map.TypeList.Add(t.FullName, t);
            //if (!t.IsAbstract && ( t.IsSubclassOf( typeof( ObjectBase ) ) || t is IEntity )) {
            //    map.ClassList[t.FullName] = EntityInfo.GetByType( t );
            //    logger.Info( "Loading Type : " + t.FullName );
            //}
            // 1029
            logger.Info("Loading Type : " + t.FullName);

            if (rft.IsInterface(t, typeof(IEntity)) && !OrmHelper.IsEntityBase(t))
            {
                map.ClassList.Add(t.FullName, EntityInfo.GetByType(t));
            }
        }
Exemplo n.º 2
0
        //1029
        private static Boolean updateParentInfo(EntityInfo info)
        {
            if (info.Type.BaseType == typeof(Object))
            {
                return(false);
            }
            if (OrmHelper.IsEntityBase(info.Type.BaseType))
            {
                return(false);
            }

            if (info.Type.BaseType.IsAbstract)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        public static IList FindList(ObjectInfo state, String sql)
        {
            IList       results   = new ArrayList();
            IDataReader rd        = null;
            Hashtable   hashtable = new Hashtable();
            IDbCommand  command   = DataFactory.GetCommand(sql, DbContext.getConnection(state.EntityInfo));

            try {
                rd = command.ExecuteReader();
                while (rd.Read())
                {
                    IDataRecord record = rd;
                    Fill_EntityProperty_Ids(record, state.Includer.EntityPropertyList, ref hashtable);

                    int    id    = Convert.ToInt32(record["Id"]);
                    Object cache = ObjectPool.FindOne(state.EntityInfo.Type, id);

                    if (cache != null)
                    {
                        results.Add(cache);
                    }
                    else
                    {
                        results.Add(FillUtil.Populate(record, state));
                    }
                }
            }
            catch (Exception ex) {
                logger.Error("sql=>" + sql);
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
                throw ex;
            }
            finally {
                OrmHelper.CloseDataReader(rd);
            }


            if (results.Count == 0)
            {
                return(results);
            }
            return(setEntityProperty(state, results, hashtable));
        }