예제 #1
0
        /// <summary>
        /// 根据条件统计对象的所有数目
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="condition">统计条件</param>
        /// <returns>对象数量</returns>
        public static int count <T>(String condition) where T : IEntity
        {
            int countResult = ObjectPool.FindCount(typeof(T), condition);

            if (countResult == -1)
            {
                countResult = ObjectDB.Count(typeof(T), condition);
                ObjectPool.AddCount(typeof(T), condition, countResult);
            }

            return(countResult);
        }
예제 #2
0
        //-------------------------------------------------------------------------

        /// <summary>
        /// 统计对象的所有数目
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns>对象数量</returns>
        public static int count <T>() where T : IEntity
        {
            int countResult = ObjectPool.FindCount(typeof(T));

            if (countResult == -1)
            {
                countResult = ObjectDb.Count(typeof(T));
                ObjectPool.AddCount(typeof(T), countResult);
            }

            return(countResult);
        }