Nhibernate multiple unique-key on same field

I have a hierarchical structure like this:

class Node
{
  Node Parent;
  string Name;
  string Code;
}

and I need to reflect in nhibernate mapping files that the combinations (Parent, Name) and (Parent, Code) BOTH are unique (even when Parent is null). Does nhibernate allows multiple unique-key on the same field? Something in the likes of

<many-to-one name="Parent" class="Node" column="ParentId" unique-key="CK1" unique-key="CK2" />

or some other alternative?

Upvotes: 0

Views: 319

Answers (1)

Diego Mijelshon
Diego Mijelshon

Reputation: 52745

You can use <database-object> to create all the indexes you want.

Upvotes: 2

Related Questions