I have a query that used to be a stored procedure and was converted to an EF query. It is timing out now. Using SQL Profiler, I can see the only difference in the SQL generated is the new behavior where EF turns entity.Property == value
into (entity.Property = @value OR (@value IS NULL AND entity.Property IS NULL))
.
I know I can turn this off for the entire context by setting UseCSharpNullComparisonBehavior = false
, but I really only want to do it for this one query. Is that possible?
Or, is there a way to write the EF query so it doesn't generate the SQL like this?