Beispiel #1
0
 /// <summary>
 /// 查询
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="query"></param>
 /// <returns></returns>
 public static T BaseGetByParam <T>(BaseQuery query)
 {
     using (IDbConnection conn = new SqlConnection(ConnString))
     {
         conn.Open();
         T item = conn.Query <T>(query.Sql, query.Obj).FirstOrDefault();
         conn.Close();
         return(item);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 查询
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="query"></param>
 /// <returns></returns>
 public static List <T> BaseGetListByParam <T>(BaseQuery query)
 {
     using (IDbConnection conn = new SqlConnection(ConnString))
     {
         conn.Open();
         List <T> item = conn.Query <T>(query.Sql, query.Obj).ToList();
         conn.Close();
         return(item);
     }
 }
Beispiel #3
0
 /// <summary>
 ///     查询
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="query"></param>
 /// <returns></returns>
 public List <T> GetListByParam <T>(BaseQuery query)
 {
     using (IDbConnection conn = new SqlConnection(_connString))
     {
         conn.Open();
         var list = conn.Query <T>(query.Sql, query.Obj).ToList();
         conn.Close();
         return(list);
     }
 }