I am new to Linq to SQL and I am looking for a concise way to get a list of Summoners from the SummonerTable based upon a primary key value "UserId" from the UserSummonerTable. Each of the Summoner1-Summoner5id's in the UserSummonerTable are Foreign Keys referencing the Primary Key "Id" from the the SummonerTable. I want to use all of the SummonerIds from the UserSummonerTable to grab all of the corresponding Summoners in the SummonerTable.
Thanks in advance!
EDIT: I have made objects for each of the tables referencing all of the columns and can grab each table individually but would like a way to do it all in one Select.
EDIT: This gets me close to what I want, although I would like to wrap the results into an Object "Summoner" with Id and Server attributes and it is very messy. I am playing around with some of the more concise forms people have suggested to no avail but I will keep reading and trying! If anyone has any suggestions they are much appreciated. As soon as I get it working as intended I will mark an answer, or is it good practice to give people credit for getting me on the right track before I figure it out fully?
MyDataContext dc = new MyDataContext(ConfigurationManager.ConnectionStrings["StatServer"].ConnectionString);
var t = (from user in dc.GetTable<UserSummoner>()
where (user.UserId.Equals(id))
select user).First();
var summoners = (from summoner in dc.GetTable<SummonerTable>()
where (summoner.Id == t.Summoner1Id || summoner.Id == t.Summoner2Id || summoner.Id == t.Summoner3Id || summoner.Id == t.Summoner4Id || summoner.Id == t.Summoner5Id)
select new { summoner.Id, summoner.Server }).ToList();