我正在努力学习NHibernate 3.2 built-in mapping by code api
(NOT Fluent NHibernate)。你能帮我映射这些实体之间的一对多关系吗?
public class Member {
public virtual int Id { get; set; }
public virtual ICollection<Comment> Comments { get; set; }
}
public class Comment {
public virtual int Id { get; set; }
public virtual Member { get; set; }
}
更新:
我像这样映射Id
:
Id(
t => t.Id,
t => {
t.Generator(Generators.HighLow, g => g.Params(new { max_low = 100 }));
t.Column(typeof(TEntity).Name + "Id");
});