I used Fluent NHibernate to connect the store and employee class, where stores can have many employees as follows:
public class Store
{
public virtual IList<Employee> Employees { get; set; }
}
public class Employee
{
public virtual Store Store { get; set; }
public virtual bool? SomeStatus1 { get; set; }
}
I need to get all stores that have employees that don't have SomeStatus1 for true.
My unsuccessful attempt lost:
Session.CreateCriteria(typeof(Store))
.Add(Restrictions.Not(Restrictions.Eq("Employees.SomeStatus1", true))
.List<Store>();
Any idea how I do this?
The reason why my attempt failed was because the Employees list does not have the SomeStatus1 property ... which is pretty obvious.
What I don't know is how to get NHibernate to receive only stores that have employees in the state I'm looking for ...
I think I want to ask NHibernate to make a connection ... but I don't know how to ask him to do this ...