Entity Framework - Why does EF use LEFT OUTER JOIN's in a 1-to-1 relationship?

Posted by Taylor L on Stack Overflow See other posts from Stack Overflow or by Taylor L
Published on 2010-03-17T00:49:12Z Indexed on 2010/03/17 1:01 UTC
Read the original article Hit count: 444

Filed under:
|
|
|
|

Why does .NET Entity Framework produce SQL that uses a subquery and left outer join on a simple 1-to-1 relationship? I expected to see a simple join on the two tables. I'm using Devart Dotconnect for Oracle. Any ideas?

Below is the output I see courtesy of the EFTracingProvider:

SELECT
1 AS C1,
"Join1".USER_ID1 AS USER_ID,
...
FROM  "MY$NAMESPACE".MYTABLE1 "Extent1"
INNER JOIN  (...
    FROM  "MY$NAMESPACE".MYTABLE2 "Extent2"
    LEFT OUTER JOIN "MY$NAMESPACE".MYTABLE1 "Extent3" ON "Extent2".OTHER_ID = "Extent3".OTHER_ID ) 
    "Join1" ON "Extent1".OTHER_ID = "Join1".OTHER_ID1
WHERE "Extent1".USER_ID = :EntityKeyValue1
-- EntityKeyValue1 (dbtype=String, size=6, direction=Input) = "000000"

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about .NET