I am getting this error on return of ByParameter
because of KeyColumn
I guess, how can I make this work?
could not resolve property: ParentId of: Entity.MenuItem
Entity.MenuItem.READ.ByParameter("ParentId", 3);
Code:
public static IList<T> ByParameter(String Parameter, Object Value)
{
using (var session = NHibernateHelper<T>.OpenSession())
{
var conjunction = new Conjunction();
conjunction.Add(Restrictions.Eq(Parameter, Value));
return session.CreateCriteria(typeof(T)).Add(conjunction).List<T>();
}
}
class MenuItemMap : Mapper<MenuItem>
{
public MenuItemMap()
{
Id(x => x.MenuItemId);
Map(x => x.Text);
HasMany(x => x.Children).KeyColumn("ParentId").Fetch.Select();
References(x => x.Parent).Fetch.Select();
}
}