In this last chapter, we have learned a lot about the possible pitfalls when using NHibernate. We have discussed under what circumstances we can fall into traps and how we can avoid this.
Specifically, we covered:
- How to avoid too verbose and inefficient mappings. We learned that lean mappings are easier to understand and maintain.
- Common anti-patterns encountered in the usage of NHibernate. We learned that we should hardly ever use database-generated IDs and always explicitly defined the boundaries of our transactions.
- The correct handling of lazy loading. We learned that under certain circumstances we need to give NHibernate a hint to avoid lazy loading altogether, we were shown how we can achieve that.
- There exist situations where the domain ...