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

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

        public static int Delete(this XConnection conn, string sql, List <XParam> dbParas = null)
        {
            CheckDelete(sql);
            return(conn.ExecuteNonQuery(sql, dbParas));
        }
Exemple #5
0
        /*
         *  剔除 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());
        }
Exemple #6
0
        /*-------------------------------------------------------------*/

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

        public static async Task <int> DeleteAsync(this XConnection conn, string sql, List <XParam> dbParas = null)
        {
            CheckDelete(sql);
            return(await conn.ExecuteNonQueryAsync(sql, dbParas));
        }
Exemple #8
0
 /// <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());
 }
Exemple #9
0
        /*-------------------------------------------------------------*/

        /// <summary>
        /// Inserter 便捷 Insert 方法
        /// </summary>
        public static int Insert <M>(this XConnection conn, M m)
            where M : class, new()
        {
            return(conn.Inserter <M>().Insert(m));
        }
Exemple #10
0
 /// <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));
 }