yangzhongke/Zack.EFCore.Batch

批量删除如何忽略全局过滤器?先忽略然后再批量删除,貌似不起作用

albert9009 opened this issue · 1 comments

TestDbContext ctx = new TestDbContext();
ctx.Users.IgnoreQueryFilters();
await ctx.DeleteRangeAsync(b => b.Id > 3);

Delete FROM T_User WHERE Id IN(SELECT Id FROM (SELECT t.Id
FROM T_User AS t
WHERE NOT (t.IsDelete) AND (t.Id > 3)) AS temp1 )

DeleteRangeAsync方法有一个参数:bool ignoreQueryFilters,设置为true就行了