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

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


3
0
Sign in
to vote
ID 641199 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 2/3/2011 11:46:51 AM
Access Restriction Public

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
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)