问题
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