Example #1
0
        /// <summary>
        /// 根据 sql 语句,查询对象
        /// </summary>
        /// <param name="t"></param>
        /// <param name="sql"></param>
        /// <returns>返回对象列表</returns>
        public static Object findBySql(Type t, String sql)
        {
            IList objList = ObjectPool.FindBySql(sql, t);

            if (objList == null)
            {
                objList = ObjectDB.FindBySql(sql, t);
                ObjectPool.AddSqlList(sql, objList);
            }
            return(objList);
        }
Example #2
0
        /// <summary>
        /// 根据 sql 语句,返回对象列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sql"></param>
        /// <returns></returns>
        public static List <T> findBySql <T>(String sql) where T : IEntity
        {
            IList objList = ObjectPool.FindBySql(sql, typeof(T));

            if (objList == null)
            {
                objList = ObjectDB.FindBySql(sql, typeof(T));
                ObjectPool.AddSqlList(sql, objList);
            }

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