SoftDeleteInterceptor generates an invalid WHERE clause

I am currently working with Entity Framework and MySql provider. Also use SoftDeleteInterceptor to filter data. The easiest way to show my problem is with an example:

context.GetQuery(m => m.AnyColumn == true || m.Name != "Test").ToList();

This is translated into:

SELECT * 
FROM `Table` AS `Extent1` 
WHERE 
    (1 = `Extent1`.`AnyCOlumn`) OR 
    ((('Test' = `Extent1`.`Name`) AND (`Extent1`.`Name` IS NOT NULL))) AND 
    `Extent1`.`Deleted` != 1;

I replaced all the columns in Select to *because this is not part of this question. My question is why ORthere are no brackets in the expression , so it can be used ANDfrom Soft Delete. Because when the left side ORis true, other conditions are skipped. How to fix it? Or how to add brackets? Any suggestions?

+4
source share

Source: https://habr.com/ru/post/1687886/


All Articles