views:

51

answers:

3

I want to start building better persistence layers using NHibernate and other ORMs. What are the best design patterns or important design considerations for implementing persistence with ORM?

+1  A: 

Couple off the top of my head...

1) Be careful not to group data that changes at drastically different rates into the same object. This can end up bloating tables with redundant data.

2) Avoid throwing in text fields that you intend to search, better to use something like Lucene for this. DBs aren't as efficient as dedicated text search libraries when doing LIKE style queries.

3) If you can make it so that your objects are immutable once written (i.e. they have a state id), then you can get very nice caching benefits on the front end and keep people from even needing to hit your server in the first place.

James Branigan
+1  A: 

A high frequent design pattern that we use is Singleton. Another things we consider to use is lazy loading and data pagination.

afsharm
+1  A: 

singleton. very useful but also useful for u wuld be the following link.... http://www.yoda.arachsys.com/csharp/singleton.html

Schnoesel15