Using Entity Framework/LINQ, I need help with the following.
The database has a table of People with an identity column of PersonId. There is also a Skills table with an identity column of SkillId. These two are connected via a third table PeopleSkills that has its own identity column PeopleSkillsId, a foreign column referencing PersonId and a foreign column referencing SkillId.
The method that I am trying to write is passed a parameter of type List that contains any number of skills that we are looking for. The method should return a List who are linked to all of the skills in the input parameter list. How do I build a list that excludes anyone without all of the skills in the Skills list?
The problem I'm having is that I have very little SQL experience. I do have lots of other programming experience, but SQL is always a bit rough for me. I thought about using a Join, but that's not going to work. i.e. if my person has skills A & B, and the search list has elements for B & C, a join would match them on B and return the person. I need this person to be excluded because he doesn't have both B & C.
I also thought about iterating through the skills list and building a filter, but that seems ugly. This just seems like a problem that LINQ was built to handle, using a List to query another List, and that there should be an elegant solution to.