In the database I have 3 tables, User, Group and a lookup table UserGroup which contains UserID and GroupId.
I create a model.edmx and this allows me to:
var users = context.User
var groups = context.Group
but does not create an object for context.UserGroup.
what is the syntax for getting all the users in a group, and all the groups that a user belongs to?
var results = from groups in db.Groups.Where(t => t.Users(u => u.UserID ==1))
select groups;
If you have the proper keys setup, EF will hide away your junction table, and create a navigation property to make the connection between the tables
For getting all the groups a user belongs to:
and for getting all the Users: