Editorials

Convention over Configuration Can Produce an Inefficient Data Model

Yesterday I considered the database schema generated by Entity Framework when using the Domain First method to generate your database in my editorial, “What is this id column in my table?” This is not to say that Entity Framework does not require the same database design if you were to the use database first method of generating your ORM. Ravi writes in with his perspective on Convention over Configuration when it comes to an ORM.

Ravi writes:

I just read your article on SSWUG.

I strongly agree with you that the there is no need to have a ID column on every table to play the role of Primary Key. I cannot image a data model where all the tables have a column called Id and it being the Primary Key on every table where the ID value means nothing for the business.

In my ideal model, depending on the business, I could have a composite key of 1-4 columns, or even little more in very rare cases, playing the role of primary key. That is how the integrity of the data could be maintained.

The best practices suggested by Microsoft, or any other company, exist because they assume a company lacking a good Data Architect could end up using a wrong model. But it turned out to be that good Data Architects now have to fight for the correct model because it is against the best practices suggested by a company like Microsoft. That’s pathetic.

Are you happy with an id column in all of your tables as a primary key, enforced by code generation software? Make your voice heard. Leave your comment here or send an Email to btaylor@sswug.org.

Cheers,

Ben