Home Dashboard Directory Help
Search

Entity Framework generates wrong SQL when querying reference properties. by .ben


Status: 

Closed
 as Fixed Help for as Fixed


3
0
Sign in
to vote
Type: Suggestion
ID: 641199
Opened: 2/3/2011 11:46:51 AM
Access Restriction: Public
0
Workaround(s)
view

Description

When querying on the name of a reference property of an entity framework entity class the query gets split between an inner and outer join, the resulting query should be far easier.

Full description can be found here: http://stackoverflow.com/questions/4829286/why-does-ef-generate-this-sql-when-quering-reference-property
Details
Sign in to post a comment.
Posted by Microsoft on 2/28/2011 at 11:36 AM
Thank you for reporting this issue. It should be addressed in the next release. Our current bits (next release) generate the TSQL that was suggested:

SELECT

FROM [HumanResources].[Employee] AS [Extent1]
INNER JOIN [Person].[Contact] AS [Extent2] ON [Extent1].[ContactID] = [Extent2].[ContactID]
WHERE [Extent2].[FirstName] IN (N'A',N'B',N'C')

Thank you,
Kati Iceva
Entity Framework Developer
Posted by Microsoft on 2/3/2011 at 11:59 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.