How to update a table with composite keys using Massive ORM?

一个人想着一个人 提交于 2019-12-12 12:11:02

问题


Using Rob Conery's Massive micro-ORM; is it possible to work with tables that have composite keys?

I can't quite see how to assign more than a single column name as 'PrimaryKeyField'. Anyone managed to do so? More specifically; How do i do an Update() when the primary key consists of two columns?


回答1:


Found this comment on GitHub; https://github.com/robconery/massive/pull/50 - with the following comment from Rob;

(...) I've had this discussion with others (using SubSonic) with respect to composite keys and to be honest - that's more code than I'd like to use to support what I consider an edge case (and not a terribly good database design outside of many to many joins)

So it seems that composite keys will not be supported. And I can totally see the reasoning behind it. Luckily we're in control over the database, so I believe we can go around it by adding a surrogate key, and let the current composite key become an unique index instead.



来源:https://stackoverflow.com/questions/9498590/how-to-update-a-table-with-composite-keys-using-massive-orm

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