Ejemplo n.º 1
0
        public static async Task <int> DeleteByIdsAsync <T>(this IDbConnection conn, object ids, IDbTransaction tran = null, int?commandTimeout = null)
        {
            if (CommonUtil.ObjectIsEmpty(ids))
            {
                return(0);
            }
            var builder            = BuilderFactory.GetBuilder(conn);
            DynamicParameters dpar = new DynamicParameters();

            dpar.Add("@ids", ids);
            return(await conn.ExecuteAsync(builder.GetDeleteByIdsSql <T>(), dpar, tran, commandTimeout));
        }
Ejemplo n.º 2
0
        public static async Task <IEnumerable <dynamic> > GetByIdsWithFieldDynamicAsync <T>(this IDbConnection conn, object ids, string field, string returnFields = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            if (CommonUtil.ObjectIsEmpty(ids))
            {
                return(Enumerable.Empty <dynamic>());
            }
            var builder            = BuilderFactory.GetBuilder(conn);
            DynamicParameters dpar = new DynamicParameters();

            dpar.Add("@ids", ids);
            return(await conn.QueryAsync(builder.GetByIdsWithFieldSql <T>(field, returnFields), dpar, tran, commandTimeout));
        }
Ejemplo n.º 3
0
        public static IEnumerable <dynamic> GetByIdsDynamic <T>(this IDbConnection conn, object ids, string returnFields = null, IDbTransaction tran = null, int?commandTimeout = null)
        {
            if (CommonUtil.ObjectIsEmpty(ids))
            {
                return(Enumerable.Empty <dynamic>());
            }
            var builder            = BuilderFactory.GetBuilder(conn);
            DynamicParameters dpar = new DynamicParameters();

            dpar.Add("@ids", ids);
            return(conn.Query(builder.GetByIdsSql <T>(returnFields), dpar, tran, true, commandTimeout));
        }