I know this is a very old question, but I figured I'd post my answer in hopes that it might help someone in the future. After banging my head on the keyboard for a little I was able to figure it out. I had the same issue as the original poster. I would get
the correct number of row back through entity framework, but every record was essentially a duplicate of the first. It boiled down to being a problem with retrieving records with no unique id as posted above. I was able to solve it by adding the AsNoTracking
to the query.
context.CustomRecords.AsNoTracking() // removed clauses for simplicity...
Doing this I was able to retrieve the correct data.
None
0 Points
1 Post
Re: EF returning two identical records when 2 different records are in the table.
Jun 12, 2015 04:31 PM|ms2474|LINK
I know this is a very old question, but I figured I'd post my answer in hopes that it might help someone in the future. After banging my head on the keyboard for a little I was able to figure it out. I had the same issue as the original poster. I would get the correct number of row back through entity framework, but every record was essentially a duplicate of the first. It boiled down to being a problem with retrieving records with no unique id as posted above. I was able to solve it by adding the AsNoTracking to the query.
Doing this I was able to retrieve the correct data.