为什么 .NET Entity Framework 生成的 SQL 使用子查询并在简单的一对一关系上使用左外连接?我希望在两个表上看到一个简单的连接。我正在使用Devart Dotconnect for Oracle。有任何想法吗?
下面是我看到的由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"