"Repro Steps:
1. Create a new console c# project
2. Create a new EntityFramework (.edmx) model generated from the AndventureWorks database using only the ""Product"" and ""Product Model"" tables
3. Add a reference to ""System.Configuration""
4. Add using statements to Program.cs for ""System.Configuration"" and ""System.Data.Objects""
5. Paste the following code in the ""Main"" method
var ctx = new AdventureWorksEntities(ConfigurationManager.ConnectionStrings[""AdventureWorksEntities""].ConnectionString);
var MinDate = new DateTime(2011, 02, 03);
var MaxDate = new DateTime(2011, 03, 04);
var q =
from p in ctx.Products
where
(p.ProductModel.ModifiedDate >= MinDate) &&
(p.ProductModel.ModifiedDate <= MaxDate)
select p.Name;
Console.WriteLine((q as ObjectQuery).ToTraceString());
Actual Results:
SELECT
[Extent1].[Name] AS [Name]
FROM [Production].[Product] AS [Extent1]
LEFT OUTER JOIN [Production].[ProductModel] AS [Extent2] ON [Extent1].[ProductModelID] = [Extent2].[ProductModelID]
INNER JOIN [Production].[ProductModel] AS [Extent3] ON [Extent1].[ProductModelID] = [Extent3].[ProductModelID]
WHERE ([Extent2].[ModifiedDate] >= @p__linq__0) AND ([Extent3].[ModifiedDate] <= @p__linq__1)
Expected Results:
SELECT
[Extent1].[Name] AS [Name]
FROM [Production].[Product] AS [Extent1]
INNER JOIN [Production].[ProductModel] AS [Extent2] ON [Extent1].[ProductModelID] = [Extent2].[ProductModelID]
WHERE ([Extent2].[ModifiedDate] >= @p__linq__0) AND ([Extent2].[ModifiedDate] <= @p__linq__1)"
This item was migrated from the DevDiv work item tracking system [ID=238676].
This work item originated from connect.microsoft.com. A member of the EF team at Microsoft should close the related Connect issue when closing this work item.
**The fix for this issue may also fix issue 486.**
http://entityframework.codeplex.com/workitem/486
1. Create a new console c# project
2. Create a new EntityFramework (.edmx) model generated from the AndventureWorks database using only the ""Product"" and ""Product Model"" tables
3. Add a reference to ""System.Configuration""
4. Add using statements to Program.cs for ""System.Configuration"" and ""System.Data.Objects""
5. Paste the following code in the ""Main"" method
var ctx = new AdventureWorksEntities(ConfigurationManager.ConnectionStrings[""AdventureWorksEntities""].ConnectionString);
var MinDate = new DateTime(2011, 02, 03);
var MaxDate = new DateTime(2011, 03, 04);
var q =
from p in ctx.Products
where
(p.ProductModel.ModifiedDate >= MinDate) &&
(p.ProductModel.ModifiedDate <= MaxDate)
select p.Name;
Console.WriteLine((q as ObjectQuery).ToTraceString());
Actual Results:
SELECT
[Extent1].[Name] AS [Name]
FROM [Production].[Product] AS [Extent1]
LEFT OUTER JOIN [Production].[ProductModel] AS [Extent2] ON [Extent1].[ProductModelID] = [Extent2].[ProductModelID]
INNER JOIN [Production].[ProductModel] AS [Extent3] ON [Extent1].[ProductModelID] = [Extent3].[ProductModelID]
WHERE ([Extent2].[ModifiedDate] >= @p__linq__0) AND ([Extent3].[ModifiedDate] <= @p__linq__1)
Expected Results:
SELECT
[Extent1].[Name] AS [Name]
FROM [Production].[Product] AS [Extent1]
INNER JOIN [Production].[ProductModel] AS [Extent2] ON [Extent1].[ProductModelID] = [Extent2].[ProductModelID]
WHERE ([Extent2].[ModifiedDate] >= @p__linq__0) AND ([Extent2].[ModifiedDate] <= @p__linq__1)"
This item was migrated from the DevDiv work item tracking system [ID=238676].
This work item originated from connect.microsoft.com. A member of the EF team at Microsoft should close the related Connect issue when closing this work item.
**The fix for this issue may also fix issue 486.**
http://entityframework.codeplex.com/workitem/486