Different results in Entity Framework than LINQ to SQL

I first used LINQ to SQL in my project and used the following statement:

var ProjectRouteEmails = EmailManagerDAL.Context.ProjectRouteEmails
            .Where(p => p.ProjectID == ProjectID);

This faithfully returned three different emails from the ProjectRouteEmails view. The identifiers returned from the email table were 117, 591, and 610.

I changed LINQ to Entities and used the same form and the same LINQ statement, but even if I return three records, this is the first record ID 117, which is returned three times.

I tried writing the LINQ element as follows:

var ProjectRouteEmails = from p in EmailManagerDAL.Context.ProjectRouteEmails
                                 where p.ProjectID == ProjectID
                                 select p;

but it did not matter; the same record returned three times.

I went into SQL Server Management Studio and ran a query:

select * from ProjectRouteEmails (nolock) 
where ProjectID = 12

and three unique entries are true.

What's going on here?

Thank!

+5
1

, ProjectRouteEmails . .

+5

All Articles