I've got a problem with my query. I have two simple classes. Let's say
public class A{
public List<B> MyCollection{get; set;}
}
public class B{
public string Id;
}
//I want to do something like that
var myB = new B{Id="1"};
context.A.Where( x=> x.MyCollection.Contains(myB)).ToList();
How can I solve this? I know that I could do something like
context.A.ToList().Where...
but that's not the good idea, especially that I have few thousands records.
UPDATE! context is a EntityFramework context and context.A represents DbSet I'm still getting error "LINQ to Entities does not recognize the method 'Boolean Contains" also I can't use
context.A.ToList().Where(....
because I have thousands of records and it will be to inefficient