ORM support for compound primary keys

 ̄綄美尐妖づ 提交于 2019-12-18 09:25:18

问题


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)


回答1:


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>
...


来源:https://stackoverflow.com/questions/218100/orm-support-for-compound-primary-keys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!