public static int Count <T>(T t) { Type type = typeof(T); SQLBasis sqlBasis = new SQLBasis(""); sqlBasis.And("", ""); return(1); }
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()); }
/// <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()); }
/// <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); }