Say I have two lists:
List<CanidateSkill> canidateSkills;
List<JobDesiredSkill> desiredSkills;
class CanidateSkill
{
public Guid CanidateId { get; set; }
public Guid SkillId { get; set; }
}
class JobDesiredSkill
{
public Guid JobId { get; set; }
public Guid SkillId { get; set; }
}
How do you determine if:
At least one item in JobDesiredSkills is contained in CandidateSkills (matched on SkillId)
All items in JobDesiredSkills are contained in CandidateSkills
I tried this, but get this error: Unable to create a constant value of type Only primitive types ('such as Int32, String, and Guid') are supported in this context.
return from candidate in _db.Candidates
where (candidate.CandidateSkills.Any(c => job.JobDesiredSkills.Any(j => j.SkillId == c.SkillId)))
select candidate;
I also tried this, but Contains expects a JobDesiredSkill object, but c is a CandidateSkillObject.
return from candidate in _db.Candidates
where CandidateSkills.Any(c => JobDesiredSkills.Contains(c))
select candidate;
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…