在我的应用程序中,我有一个User
只有一个类的Settings
类。一对一的关系我有一个简单的用户 NHibernate 映射:
/// NHibernate declarations etc
<id name="squid" type="guid">
<generator class="assigned" />
</id>
/// Properties
<one-to-one class="Settings" name="Settings" outer-join="true" cascade="save-update" />
/// Close tags & end file
我的设置类是
/// NHibernate declarations
<id name="squid" type="guid">
<generator class="assigned" />
</id>
/// Properties, close tags & end of file
如您所见,我的用户被分配了一个基于其 Active Directory 帐户的 guid(或在我的单元测试中,由 生成的新 Guid Guid.NewGuid()
)
NHibernate 是否可以神奇地将设置 GUID 分配为用户 GUID?