Exemple #1
0
        /*-------------------------------------------------------------*/

        /// <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());
        }
Exemple #2
0
 /// <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());
 }
Exemple #3
0
        /*-------------------------------------------------------------*/

        /// <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());
        }
Exemple #4
0
        /*-------------------------------------------------------------*/

        public static int Update(this XConnection conn, string sql, List <XParam> dbParas = null)
        {
            CheckUpdate(sql);
            return(conn.ExecuteNonQuery(sql, dbParas));
        }
Exemple #5
0
        /*-------------------------------------------------------------*/

        public static async Task <int> UpdateAsync(this XConnection conn, string sql, List <XParam> dbParas = null)
        {
            CheckUpdate(sql);
            return(await conn.ExecuteNonQueryAsync(sql, dbParas));
        }