I have a mant-to-many relationship modeled in the database (with a bridge table) between Student and Professor (_students_selected) , in my entites i have modeled it as a many-to-many relationship i.e. a Professor has many Students.
HasManyToMany(x => x.Students)
.Table("_students_selected").ChildKeyColumn("student_key").ParentKeyColumn("professor_key");
public class Professor
{
private IList<Students> _students;
public virtual Student Students
{
get { return _students; }
set { _students = value; }
}
}
I am unable to query over the professors students, i have tried the following however nhibernate does not recognise Any to filter through the list. Whats the equivalent to any?
_unitOfWork.Session.QueryOver<Professor>()
.Where(x => x.Students.Any(i => i.Id.IsIn(childStudentList))).List();