public class Address
{
public int Number { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string PostCode { get; set; }
}
public class Person
{
public int Id { get; set; }
public Address Address { get; set; }
}
public PersonMap()
{
Id( x => x.Id );
Component(x => x.Address, m =>
{
m.Map(x => x.Number);
m.Map(x => x.Street);
m.Map(x => x.City);
m.Map(x => x.PostCode);
});
}
1 回答
nhibernate中的组件通常是引用对象的完全包含的对象
以下是Fluent-Nhibernate Mapping Documentation - ComponentMap<T>
数据库应该是
表:人
同上
数量
街
城市
PostCode
链接:
nhibernate mapping component
Fluent Mapping