I have Job, Tag and TagDto classes. Job class has ICollection<Tag> Tags
list. I have query that has all the jobs in it as a IQueryable<Job>
list. I have to now select those Jobs that has one or more tags in the Job.Tags list in input.Tags
list(which is List<TagDto>
) as a new list.
IQueryabke<Job> query;
List<TagDto> input.Tags;
class Job
{
ICollection<Tag> Tags;
}
class Tag
{
string Text;
other properties...
}
class TagDto
{
string Text;
other properties...
}
I have tried something like
query = query.Where(p => input.Tags.Any(inputTag => p.Tags.Any(tag => tag.Id == inputTag.Id)));
But I get the error "Unable to create a constant value of type 'ProjectA.Tags.TagDto'. Only primitive types or enumeration types are supported in this context."