Hello,
EF Core version: main (has modifications...)
Database provider: my own
Model:
[Table("TEST_MODIFY_ROW2")]
public sealed class TEST_RECORD
{
[Key]
[Column("TEST_ID")]
public System.Int64? TEST_ID { get; set; }
[Column("COL_BOOLEAN")]
public System.Boolean? COL_DATA1 { get; set; }
[Column("COL2_BOOLEAN")]
public System.Boolean? COL_DATA2 { get; set; }
};//class TEST_RECORD
Expression:
var recs=db.testTable.Where(r => (r.COL_DATA1|r.COL_DATA2)==null && r.TEST_ID==testID);
SQL:
SELECT "t"."TEST_ID", "t"."COL_BOOLEAN", "t"."COL2_BOOLEAN"
FROM "TEST_MODIFY_ROW2" AS "t"
WHERE "t"."COL_BOOLEAN" OR "t"."COL2_BOOLEAN" IS NULL AND ("t"."TEST_ID" = :__testID_0)
For me (I do not like think about priority and order in expressions), will be nice see the round brackets around "t"."COL_BOOLEAN" OR "t"."COL2_BOOLEAN":
SELECT "t"."TEST_ID", "t"."COL_BOOLEAN", "t"."COL2_BOOLEAN"
FROM "TEST_MODIFY_ROW2" AS "t"
WHERE ("t"."COL_BOOLEAN" OR "t"."COL2_BOOLEAN") IS NULL AND ("t"."TEST_ID" = :__testID_0)
For me (I do not like think about priority and order in expressions), will be nice see the round brackets around [...]
It's probably better for your provider to have parentheses only where the operator precedence requires them, rather than personal preference. If you want to add parentheses, you're free to override QuerySqlGenerator.VisitSqlBinary and add them wherever you want. Here's an example of EFCore.PG doing it in a certain case where operator precedence requires it.
Most helpful comment
It's probably better for your provider to have parentheses only where the operator precedence requires them, rather than personal preference. If you want to add parentheses, you're free to override QuerySqlGenerator.VisitSqlBinary and add them wherever you want. Here's an example of EFCore.PG doing it in a certain case where operator precedence requires it.