I use global filter from Microsoft.EntityFrameworkCore 3.1.9 on my table Object (…HasQueryFilter(x => !x.IsDeleted)
I am also using LinqToDB.EntityFrameworkCore 3.7.0 for updating and deleting records in db.
To disable filter on queries generated by LinqToDB as I understood I cannot use .IgnoreQueryFilters() from Microsoft.EntityFrameworkCore (correct if I am wrong).
In any case, currently I use .IgnoreFilters() on such queries, however it seems for me that it does not disable filter in below case.
CASE
- I have the following Linq
ctx.MainObjects.IgnoreFilters().Where(mo => mo.Objects.Count == 0).DeleteAsync();
This part “mo.Objects.Count == 0” is translated as below i.e. contains global filter still applied.
SELECT
Count(*)
FROM
database."Objects" x
WHERE
**x."IsDeleted" = False** AND mo."Id" = mo."MainObjectId"
QUESTION
- Can somebody advise how to disable this filter on such queries?
WHAT I TRIED
I tried to use .IgnoreQueryFilters() but i got some exceptions as index out of range smth like that.
I googled and did not find anything on such exception.
I tried to find some docs re this case but found nothing