Object Relational Mapping Design Patterns
I w开发者_运维问答ant 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?
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.
A high frequent design pattern that we use is Singleton. Another things we consider to use is lazy loading and data pagination.
singleton. very useful but also useful for u wuld be the following link.... http://www.yoda.arachsys.com/csharp/singleton.html
精彩评论