Linq To Entities using a view is returning duplicated values -
i using linq on view in sql server database. concrete sentence following:
var valoresfiltrados = context.vdonotuse_v2.select(donotuse => donotuse).where(donotuse => donotuse.platformvalue.equals(platform) && donotuse.bank.equals(bank) && donotuse.languagevalue.equals("cze_cz")).orderby(donotuse => donotuse.id);
where vdonotuse view's entity. sentece returning duplicated values (the first ids example 12170, 12171, 12170, 12171, 12204...) , values not ordered, can see in example. however, if use sqldataadapter following sentence (which sure equivalent linq one), works , returns correct values:
"select * vdonotuse_v2 platformvalue = '" + platform + "' , bank = '" + bank + "' , languagevalue = 'cze_cz' order id asc"
of course, both of them using same connection , database.
does knows why happening?
you need make sure have set entity keys in entity datamodel view correctly. find default entity keys wrong.
Comments
Post a Comment