/*-------------------------------------------------------------*/ /// <summary> /// Queryer 便捷 CountAsync 方法 /// </summary> public static int Count <M>(this XConnection conn, Expression <Func <M, bool> > compareFunc) where M : class, new() { return(conn.Queryer <M>().Where(compareFunc).Count()); }
/// <summary> /// Queryer 便捷 CountAsync 方法 /// </summary> public static async Task <int> CountAsync <M>(this XConnection conn, Expression <Func <M, bool> > compareFunc) where M : class, new() { return(await conn.Queryer <M>().Where(compareFunc).CountAsync()); }
/*-------------------------------------------------------------*/ /// <summary> /// Updater 便捷 UpdateAsync update fields 方法 /// </summary> public static int Update <M> (this XConnection conn, Expression <Func <M, bool> > compareFunc, dynamic filedsObject) where M : class, new() { return(conn.Updater <M>().Set(filedsObject as object).Where(compareFunc).Update()); }
/*-------------------------------------------------------------*/ public static int Update(this XConnection conn, string sql, List <XParam> dbParas = null) { CheckUpdate(sql); return(conn.ExecuteNonQuery(sql, dbParas)); }
/*-------------------------------------------------------------*/ public static async Task <int> UpdateAsync(this XConnection conn, string sql, List <XParam> dbParas = null) { CheckUpdate(sql); return(await conn.ExecuteNonQueryAsync(sql, dbParas)); }