I need to return the count for the below voters:
Users has many to many relationship with Voters. I would like to return Voters count related to Users. I’ve tried this: db.Users.Voters.Count() but fails miserably as it does not recognize .Voters.
Is there any way to do this directly?
I’m assuming
.Votersis a property of a singleUserobject, not a property of theUserscollection. In that case one way would be:but that will double-count any voters that are shared by users. If instead you want a distinct count use