records of autos, that are not referenced to the employee records. Both works.
So, question: Which of the approaches is more proper for this goal? I think to check navigation property on null is weird and i'm not sure about nullable/not nullable type scenarios.
But second query is too complex and may be unefficient. Is there better way?
Sounds like auto and employee have 1 to 1 relationship? In that case, I’m pretty sure you would prefer the first option (or an alternative with employeeId check) to prevent unnecessary joins/subselects from happening. By the way, you can always inspect the logs and find the actual sql query being generated so you can then build a plan for it and verify it does what you need it to do
Обсуждают сегодня