When I try to run this piece of logic, NHibernate comes back with an error stating it has no reference to "Site".
IQueryable<Product> query = this.RetrieveAll();
query = query.Where(x => x.Status == Product.Statuses.Approved || x.SiteProduct.Where(y => y.Site.ID == siteID).Count() > 0);
A little background. Product has a One to Many Map to SiteProduct SiteProduct has a One to Many Map to Site
Even a simpler version has issues it states it has no reference to ID:
IQueryable<Product> query = this.RetrieveAll();
query = query.Where(x => x.Status == Product.Statuses.Approved || x.SiteProduct.Where(y => y.ID > 0).Count() > 0);
Does NHibernate have issues with nesting "Where" statements within itself?
As for the table mappings, they appear to be correct since I can transverse all the way down and capture individual records at the bottom through lazy loading. Addition, Getting and Deleting records all works perfectly. I am just having problems with nesting my Linq query.