public static async Task <List <byte[]> > SelectListAsync <M>(this XConnection conn, Expression <Func <M, bool> > compareFunc, Expression <Func <M, byte[]> > columnMapFunc) where M : class, new() { return(await conn.Selecter <M>().Where(compareFunc).SelectListAsync(columnMapFunc)); }
public static decimal?Sum <M>(this XConnection conn, Expression <Func <M, bool> > compareFunc, Expression <Func <M, decimal?> > propertyFunc) where M : class, new() { return(conn.Selecter <M>().Where(compareFunc).Sum(propertyFunc)); }
/*-------------------------------------------------------------*/ public static F Sum <M, F>(this XConnection conn, Expression <Func <M, bool> > compareFunc, Expression <Func <M, F> > propertyFunc) where M : class, new() where F : struct { return(conn.Selecter <M>().Where(compareFunc).Sum(propertyFunc)); }
/*-------------------------------------------------------------*/ public static int Delete(this XConnection conn, string sql, List <XParam> dbParas = null) { CheckDelete(sql); return(conn.ExecuteNonQuery(sql, dbParas)); }
/* * 剔除 sql server 支持, 拥抱开源 , 仅支持 mysql * [EditorBrowsable(EditorBrowsableState.Never)] * [Obsolete("Use Register(Component.For<T>().Lifestyle.Is(lifestyle)) instead.")] */ #region Internal /* 内部方法 */ private static async Task <int> ExecuteNonQueryAsync(this XConnection conn, string sql, List <XParam> dbParas = null) { var dc = DcForSQL(conn, sql, dbParas); return(await new ExecuteNonQuerySQLAsyncImpl(dc).ExecuteNonQueryAsync()); }
/*-------------------------------------------------------------*/ /// <summary> /// Deleter 便捷 DeleteAsync 方法 /// </summary> public static int Delete <M>(this XConnection conn, Expression <Func <M, bool> > compareFunc) where M : class, new() { return(conn.Deleter <M>().Where(compareFunc).Delete()); }
/*-------------------------------------------------------------*/ public static async Task <int> DeleteAsync(this XConnection conn, string sql, List <XParam> dbParas = null) { CheckDelete(sql); return(await conn.ExecuteNonQueryAsync(sql, dbParas)); }
/// <summary> /// Deleter 便捷 DeleteAsync 方法 /// </summary> public static async Task <int> DeleteAsync <M>(this XConnection conn, Expression <Func <M, bool> > compareFunc) where M : class, new() { return(await conn.Deleter <M>().Where(compareFunc).DeleteAsync()); }
/*-------------------------------------------------------------*/ /// <summary> /// Inserter 便捷 Insert 方法 /// </summary> public static int Insert <M>(this XConnection conn, M m) where M : class, new() { return(conn.Inserter <M>().Insert(m)); }
/// <summary> /// Inserter 便捷 InsertAsync 方法 /// </summary> public static async Task <int> InsertAsync <M>(this XConnection conn, M m) where M : class, new() { return(await conn.Inserter <M>().InsertAsync(m)); }