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));
        }
        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));
        }
Example #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));
        }