public static async Task <long> GetTotalAsync <T>(this IDbConnection conn, string where = null, object param = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.ExecuteScalarAsync <long>(builder.GetTotalSql <T>(where), param, tran, commandTimeout));
        }
        public static async Task <IEnumerable <dynamic> > GetAllDynamicAsync <T>(this IDbConnection conn, string returnFields = null, string orderBy = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.QueryAsync(builder.GetAllSql <T>(returnFields, orderBy), null, tran, commandTimeout));
        }
        public static async Task <IdType> GetIdentityAsync <IdType>(this IDbConnection conn, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.ExecuteScalarAsync <IdType>(builder.GetIdentitySql(), null, tran, commandTimeout));
        }
        public static async Task <IdType> GetSequenceNextAsync <IdType>(this IDbConnection conn, string sequence, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.ExecuteScalarAsync <IdType>(builder.GetSequenceNextSql(sequence), null, tran, commandTimeout));
        }
        public static async Task <dynamic> InsertReturnIdAsync <T>(this IDbConnection conn, T model, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.ExecuteScalarAsync <dynamic>(builder.GetInsertReturnIdSql <T>(), model, tran, commandTimeout));
        }
Example #6
0
        public static int Update <T>(this IDbConnection conn, T model, string updateFields = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(conn.Execute(builder.GetUpdateSql <T>(updateFields), model, tran, commandTimeout));
        }
Example #7
0
        public static DataTable GetSchemaTable <T>(this IDbConnection conn, string returnFields = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(GetDataTable(conn, builder.GetSchemaTableSql <T>(returnFields), null, tran, commandTimeout));
        }
        public static async Task <IEnumerable <T> > GetBySkipTakeAsync <T>(this IDbConnection conn, int skip, int take, string where = null, object param = null, string returnFields = null, string orderBy = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.QueryAsync <T>(builder.GetBySkipTakeSql <T>(skip, take, where, returnFields, orderBy), param, tran, commandTimeout));
        }
Example #9
0
        public static IEnumerable <dynamic> GetByWhereDynamic <T>(this IDbConnection conn, string where, object param = null, string returnFields = null, string orderBy = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(conn.Query(builder.GetByWhereSql <T>(where, returnFields, orderBy), param, tran, true, commandTimeout));
        }
Example #10
0
        public static IEnumerable <T> GetByPageIndex <T>(this IDbConnection conn, int pageIndex, int pageSize, string where = null, object param = null, string returnFields = null, string orderBy = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(conn.Query <T>(builder.GetByPageIndexSql <T>(pageIndex, pageSize, where, returnFields, orderBy), param, tran, true, commandTimeout));
        }
Example #11
0
        public static IEnumerable <T> GetAll <T>(this IDbConnection conn, string returnFields = null, string orderBy = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(conn.Query <T>(builder.GetAllSql <T>(returnFields, orderBy), null, tran, true, commandTimeout));
        }
Example #12
0
        public static IdType GetSequenceCurrent <IdType>(this IDbConnection conn, string sequence, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(conn.ExecuteScalar <IdType>(builder.GetSequenceCurrentSql(sequence), null, tran, commandTimeout));
        }
Example #13
0
        public static int Delete <T>(this IDbConnection conn, object id, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(conn.Execute(builder.GetDeleteByIdSql <T>(), new { id = id }, tran, commandTimeout));
        }
        public static async Task <dynamic> GetByIdDynamicAsync <T>(this IDbConnection conn, object id, string returnFields = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.QueryFirstOrDefaultAsync <dynamic>(builder.GetByIdSql <T>(returnFields), new { id = id }, tran, commandTimeout));
        }
        public static async Task <int> UpdateByWhereAsync <T>(this IDbConnection conn, T model, string where, string updateFields, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.ExecuteAsync(builder.GetUpdateByWhereSql <T>(where, updateFields), model, tran, commandTimeout));
        }
        public static async Task <dynamic> GetByWhereFirstDynamicAsync <T>(this IDbConnection conn, string where, object param = null, string returnFields = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.QueryFirstOrDefaultAsync <dynamic>(builder.GetByWhereFirstSql <T>(where, returnFields), param, tran, commandTimeout));
        }
        public static async Task <int> DeleteByWhereAsync <T>(this IDbConnection conn, string where, object param, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.ExecuteAsync(builder.GetDeleteByWhereSql <T>(where), param, tran, commandTimeout));
        }
        public static async Task <IEnumerable <dynamic> > GetByPageIndexDynamicAsync <T>(this IDbConnection conn, int pageIndex, int pageSize, string where = null, object param = null, string returnFields = null, string orderBy = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.QueryAsync(builder.GetByPageIndexSql <T>(pageIndex, pageSize, where, returnFields, orderBy), param, tran, commandTimeout));
        }
        public static async Task <int> DeleteAllAsync <T>(this IDbConnection conn, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.ExecuteAsync(builder.GetDeleteAllSql <T>(), null, tran, commandTimeout));
        }
        public static async Task <int> InsertIdentityAsync <T>(this IDbConnection conn, T model, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(await conn.ExecuteAsync(builder.GetInsertIdentitySql <T>(), model, tran, commandTimeout));
        }
Example #21
0
        public static int Insert <T>(this IDbConnection conn, T model, IDbTransaction tran = null, int?commandTimeout = null)
        {
            var builder = BuilderFactory.GetBuilder(conn);

            return(conn.Execute(builder.GetInsertSql <T>(), model, tran, commandTimeout));
        }