entity framework - How can I get distinct results from this LINQ query? -


below erd , sample data. note, i'm using entity framework , code first control database.

enter image description here

for project named vacation, return distinct users have "true" value in userbooleanattributes table either parents or teens rows defined in userattributes table.

here current attempt:

                var myquery =                     p in context.projects                     join ua in context.userattributes on p.projectid equals ua.projectid                     join uba in context.userbooleanattributes on ua.userattributeid equals uba.userattributeid                     join u in context.users on uba.userid equals u.userid                     p.projectid == 1                     uba.value == true                     (ua.userattributeid == 1 || ua.userattributeid == 2)                     select new { uba = u }; 

this returns 6 users, e@acme.org being listed twice. there linq way of returning distinct values? suppose convert list filter, i'd rather have database work.

i'd rather avoid using lambda expressions if possible. once again, want database work, , not have write code union/intersect result groups.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -