When using an ORM, what are some things to watch out for in your database design

ormperformance

What are some database design gotchas to watch out for when you know the database will be accessed using a Object Relational Mapper (ORM) Wikipedia? Also see Entity Framework NHibernate or LLBLGenPro.

As an example, I'll note the 2100 parameter limit on SqlServer's RPC call. This is a problem when using LLBLgen and joining tables when compound primary keys were utilized see MSDN article for compound keys.

Best Answer

Go through standard normalization techniques, mainly to 3rd normal form. Some ORMs can pick up on the relationships defined at the database level so you won't have to manually.

I would really go the other way and ask what should I know about ORMs. Make sure you know: - How do I profile the queries? - How can I override the ORM and write my own query? - Can I use stored procs instead?

The database should be ORM agnostic since, more than likely, it will outlast the app.