ORM 支持复合主键 [英] ORM support for compound primary keys

查看:26
本文介绍了ORM 支持复合主键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过复合主键将 混淆典型的 ORM 代码生成器.哪些 ORM 最适合复合 PK,哪些要避免?(我对 .NET 特别感兴趣)

I've read that compound primary keys will confuse the hell out of typical ORM code generators. Which ORMs work best with compound PKs and which to avoid? (I've a particular interest in .NET)

推荐答案

我使用复合键成功地使用了 NHibernate.

I'm using NHibernate successfully with compound keys.

<class name="UserProfileField" table="UserProfileFields">
    <composite-id>
        <key-many-to-one name="Parent" column="UserId" lazy="false"/>
        <key-property name="FieldName"/>
    </composite-id>
...

这篇关于ORM 支持复合主键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆