开发者

Nhibernate multiple unique-key on same field

开发者 https://www.devze.com 2023-01-07 22:21 出处:网络
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) 开发者_StackO

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) 开发者_StackOverflow社区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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号