[ActiveRecord]
public class Category
{
private int _id;
private string _name;
private Category _category;
[PrimaryKey(PrimaryKeyType.HiLo, "id", Params = "max_lo=9")]
public long Id
{
get { return _id; }
protected internal set { _id = value; }
}
[Property]
public string Name
{
get { return _name; }
set { _name = value; }
}
[BelongsTo("ParentCategoryId")]
public Category ParentCategory
{
get { return _category;}
set { _category = value; }
}
}
表在数据库中正确生成,数据可在无问题的情况下分类
但是,当我跑时,我就跑了。
var criteria = DetachedCriteria.For<Category>
.Add(Restrictions.Eq("ParentCategory.ParentCategoryId", testCategory.id));
Assert.That(m_repository.FindAll(criteria).Length, Is.EqualTo(1));
页: 1
`NHibernate.QueryException : could not resolve property: ParentCategory.ParentCategoryId
任何想法?