public void BuildDeleteQuery_CorrectParamsPassed_CorrectQueryReturned() { // Arrange & Act var objIds = _objs.Select(o => o.Id).ToList(); var sql = SqlQueryBuilder.BuildDeleteQuery(_tableName, objIds); // Assert Assert.AreNotEqual(string.Empty, sql); }
public static async Task BatchDeleteAsync <T, TK>( this DbSet <T> set, List <TK> ids ) where T : class { if (ids.Count < 1) { return; } var idBatches = ids.Batches(BatchSize); var ctx = set.GetDbContext(); foreach (var idBatch in idBatches) { var sql = SqlQueryBuilder.BuildDeleteQuery( set.GetTableName(), idBatch.ToList() ); await ctx.Database.ExecuteSqlRawAsync(sql); } }