Last Updated: February 25, 2016
· neelamsk
262292 425479734154770 939732499 n

Entity framework - beware of duplicate records

One thing I learnt while using entity framework is to always have a unique column in your select statement. Specially when you are using views in LINQ queries. Else you will end up having duplicate record for some weird reason.
Though your count will be the expected count of results, but there will be duplicate rows instead of uniques.
I ended up in a big mess because of this, I had to send an emailer where I used LINQ to fetch my record from SQL Sever View. I just had two columns in there - name,email - no unique ID!! There were duplicate records because of which some people got same mail 100 times!!!!!!!!!!!!!!!!!!!!!!.
So Beware!!!

Say Thanks