For instance, in this example Employee and Address has a many-to-many relationship, and an Employee class has a property
public virtual IList<Address> Addresses { get; set; }
In this example, how would I create a linq query to get all Employee that has X as one of its address (X is a Address variable)?
I can think of:
q => q.Where(employee => employee.Addresses.IndexOf(X)>=0);
But I think this will not be optimised and will be very costly.
Try this:
for example