Wednesday, June 18, 2014

How to solve, Entity Framework return duplicated records from a view if there is no key in the view


1. Make sure the view should be a key there. And marked as Entity key
2. If do not have a key, add one by Row number
ID= ROW_NUMBER() OVER (ORDER BY fieldName DESC)

Do not forget: marked that field as Entity key in Edmx file

Reference:
http://jepsonsblog.blogspot.in/2011/11/enitity-framework-duplicate-rows-in.html?showComment=1348809764880#c1389404724781617559