views:

152

answers:

0

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"