My SQL query against a particular view returns me 3 different rows.
select * from vwSummary
where vidate >= \'10-15-2010\' and vidate <= \'10-15-2010\'
I had a similar issue and I solved it by changing the merge option of the ObjectSet. Example:
using (TargetDBDataContext db = new TargetDBDataContext())
{
db.SomeView.MergeOption = System.Data.Objects.MergeOption.NoTracking;
return db. SomeView.ToList();
}
It looks like entity framework(EF) doesn’t handle correctly views that have duplicated primary keys or no primary keys at all. So when there are two rows that EF is considering equal, EF will load first row as it should but will not load the second row because it will consider it’s already loaded.