I have the following model:
public class Device
{
//....
private ICollection<TagDevice> _tagDevices;
public virtual ICollection<TagDevice> TagDevices { get => _tagDevices ?? (_tagDevices = new List<TagDevice>()); protected set => _tagDevices = value; }
}
public class TagDevice
{
//....
public int TagId { get; set; }
}
I need to select all Devices, which has ALL TagIds from int array.
For example:
device1 has tags [1, 2, 3]
device2 has tags [2, 3, 4]
device3 has tags [3, 4, 5]
tagsApplied is [2,3]
result: returned device1 and device2
I try
query = query.Where(p => tagsApplied.Contains( )
but this method allows only one element, not element list
How to do it?
Alloperator.