I have a table called ASB and a table called PeopleInvolved. There is a junction table called PeopleInvolved_ASB which simply contains an ASBID and a PeopleInvolvedID column. The columns act as a composite primary key.
The designer does not show the junction table (as expected). I want to retrieve a list of PeopleInvolved based on an ASBID.
To retrieve the people, I'm doing this:
// This top line gets the ASB record from the Case
var asbRecord = (from c in dd.Case
where c.CaseID == caseID
select c.ASB).First();
var asbID = asbRecord.Select(asb => asb.ASBID).First();
var people = (from asb in dd.ASB
where asb.ASBID == asbID
select asb.PeopleInvolved);
Now, what I want to do is add each PeopleInvolved record to a simple list of type PeopleInvolved. I can't do this though. I keep getting:
Error 4 Cannot convert type 'System.Data.Objects.DataClasses.EntityCollection' to 'Dynamic.PeopleInvolved'
How can I get a simple list of PeopleInvolved into a generic list that I can pass back to my controller?
Thanks,