Here's a simple LINQ query:
var objs = db.Objects.Where(o => o.Field1 == val);
This translates to SQL query:
select * from [Object] where Field1 = @p1
Trouble is, the value of val
can also legitimately be null. And SQL doesn't like comparing nulls; it insists on the syntax ... where Field1 is null
.
Is there any way of doing this neatly, short of using a ??
/ isnull
operation?