GenDotNet Tools (at CodePlex) Fail with AdventureWorksLT

AdventureWorksLT might look like a good database to get started with if you want to look at the GenDotNet tools (they are still in a very alpha state), but its not. The reason is the use of multi-part primary keys. I don’t know how much to support these in the tool, so for now they just aren’t supported.

The underlying question is whether your many-to-many tables should have their own primary key and use the parent primary keys as logical keys, or whether the parent primary keys should be combined into a multi-part primary key. Because my many-to-many tables often have, or evolve into having a payload, I use the first approach. The second becomes relatively complex at a number of points in the generation process.

If you feel multi-column primary keys are tremendously important or valuable, I’d love to know why.

For now, multi-column primary keys and tables without primary keys are simply not supported.

3 thoughts on “GenDotNet Tools (at CodePlex) Fail with AdventureWorksLT”

  1. I have, upon rare occasion, used a multi-column primary key. The cases have been I have a table with entries repeating at set times (a table for a real-time dashboard for example) that the primary key is a time stamp coupled with a foreign key the time sensitive data is for. The reason is data integrity – I can’t have two records at the same time for the same foreign key.

    I could have done the same with a constraint on the fields, so I can’t say this is a must have feature. Like you, in a many-to-many table the risk/odds of having some meta-data about the relationship is high enough I go ahead and create a primary key for the many-to-many table.

  2. Multi-column primary keys are tremendously dumb. Anyone using Multi-column primary keys has never heard of foriegn keys.

  3. Mike…you should have used ‘Id’ int identity column as the primary key. So your table would have had three columns: PK, timestamp, FK

    Many-to-many relationships should use a third table to defines the relationship…it would contain Id as the PK and the two FKs.

Leave a Reply

Your email address will not be published. Required fields are marked *