I have a SiteProduct class with a Product (class) property and a Site (class) property. It is a mapping to an assosiation table for a many yo many relation between Site and Product.
I get the "could not resolve property" error for the following because it looks like the Product property is not initialised.
{CProxyTypeElementSix_Library_DomainLayerProductDomainLayer_NHibernate_ProxyINHibernateProxy1}
But this is inside a session and the object graph has been locked for the current session.
How can I do this correctly?
Code:
ICriteria criteria = Session.CreateCriteria(typeof(SiteProduct));
criteria.Add(Expression.Like("Product.Name", name));
criteria.Add(Expression.Eq("Product.Category.ID", categoryID));
criteria.Add(Expression.Eq("Product.IsComposite", isComposite));
criteria.Add(Expression.Eq("IsProduced", isProduced));
criteria.Add(Expression.IsNull("DeletedOn"));
IList<SiteProduct> siteProducts = criteria.List<SiteProduct>();
{"could not resolve property: Product.IsComposite of: ElementSix.Library.DomainLayer.SiteProduct"}