Reputation: 19423
Motivation: I am a solo developer so I take all kinds of roles during development from programming to UI design to database design, etc. (it is pretty exhausting). We all know that one person can't be good at everything (or many things) and another thing I know for sure is that databases should be well designed and normalized.
Assumption: Assume that I am a very good object-oriented developer and I design my domain models following best practices (e.g. SOLID) and patterns.
Question: If my domain model is very well designed and I used an ORM (e.g. Nhibernate, Entity Framework, etc.) to generate the database from that model, will the generated database be normalized?
Upvotes: 1
Views: 166
Reputation: 236268
Generated database will depend on your entities mapping. If you are asking about default mapping, which will be used, then generated database could be not normalized.
For example, if you have nice inheritance hierarchy by default Entity Framework will use table per hierarchy (TPH) mapping, which enables polymorphism by denormalizing SQL schema. TPH uses discriminator column to store all types from hierarchy in single table. TPH violates third normal form because discriminator column is not part of primary key, but some columns depend on discriminator value.
Upvotes: 3