예제 #1
0
        public static int Count <T>(T t)
        {
            Type     type     = typeof(T);
            SQLBasis sqlBasis = new SQLBasis("");

            sqlBasis.And("", "");
            return(1);
        }
예제 #2
0
        public T OneModel <T>(SQLBasis sqlBasis)
        {
            string sql = sqlBasis.Sqllinq();

            string type = sqlBasis.Tname();

            string sqlwhere = string.Format(@"select * from {0} where 1=1 ", type);

            sqlwhere = sqlwhere + sql;

            return(dataBase.Database.SqlQuery <T>(sqlwhere).FirstOrDefault());
        }
예제 #3
0
        /// <summary>
        /// 查找Model 的表
        /// </summary>
        /// <typeparam name="T">Model 名</typeparam>
        /// <param name="sqlBasis"></param>
        /// <returns></returns>

        public List <T> GetAllModel <T>(SQLBasis sqlBasis)
        {
            string sql = sqlBasis.Sqllinq();

            string type = sqlBasis.Tname();

            string sqlwhere = string.Format(@"select * from {0} where 1=1 ", type);

            sqlwhere = sqlwhere + sql;

            return(dataBase.Database.SqlQuery <T>(sqlwhere).ToList());
        }
예제 #4
0
        /// <summary>
        /// 总数
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sqlBasis"></param>
        /// <returns></returns>
        public int GetCount <T>(SQLBasis sqlBasis)
        {
            string sql = sqlBasis.Sqllinq();

            string type = sqlBasis.Tname();

            string sqlwhere = string.Format(@"select Count(*) from {0} where 1=1 ", type);

            sqlwhere = sqlwhere + sql;

            int i = 0;

            using (DataBase DB = new DataBase())
            {
                i = Convert.ToInt16(DB.Database.SqlQuery <T>(sqlwhere));
            }
            return(i);
        }