ORM support for compound primary keys
-
03-07-2019 - |
Question
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)
Solution
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>
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow