0

我需要在多个属性上定义一个唯一约束。在 XML 中,这看起来像:

<properties name="Name" unique="true">
  <property name="FirstName" />
  <property name="LastName" />
</properties>

NHibernate (3.3+) 中的对应代码映射是什么?有没有其他方法可以创建多列唯一索引?

4

1 回答 1

0

创建唯一索引的另一种方法如下:

this.Property(x => x.FirstName, m => m.UniqueKey("name"));
this.Property(x => x.LastName, m => m.UniqueKey("name"));

不过,我仍然没有找到如何映射<properties>

于 2014-02-27T11:56:14.747 回答