Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 8
0
        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));
        }
Esempio n. 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));
        }
Esempio n. 10
0
        public static IEnumerable <T> GetByPageIndex <T>(this IDbConnection conn, string query, 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>(query, pageIndex, pageSize, where, returnFields, orderBy), param, tran, true, commandTimeout));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 14
0
        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));
        }
Esempio n. 15
0
        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));
        }
Esempio n. 16
0
        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));
        }
Esempio n. 17
0
        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));
        }
Esempio n. 18
0
        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));
        }
Esempio n. 19
0
        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));
        }
Esempio n. 20
0
        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));
        }
Esempio n. 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));
        }