fluent NHibernate one-to-one relationship?

邮差的信 提交于 2019-12-06 04:08:06

presuming your Person mapping is pretty standard, the way you do this is by saying:

Id(x => x.BusinessEntityId)
     .GeneratedBy.Foreign("BusinessEntity");

on the Person class.

This presumes that your Person class has a property called BusinessEntity which is of type BusinessEntity.

You'll also need to map BusinessEntity to Person with constrained set to true (to say that they primary key of Person is a foreign key reference to BusinessEntity).

The key thing is the GeneratedBy.Foreign() to say that your identity is generated by a link to another class.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!