460 likes | 567 Vues
This comprehensive guide explores NHibernate, detailing mapping techniques, session management, and advanced querying options. Discover how to work with detached objects, component and value types, and inheritance strategies. Gain insights into concurrency management, troubleshooting common errors, and optimizing performance when interfacing with legacy databases. We also review the evolution of NHibernate from its roots in Java to the upcoming features in release 3.0. This resource is perfect for developers looking to harness the power of NHibernate in their applications.
E N D
Agenda • Intro • Basics (Mapping / Session) • More mapping and querying options • Detached objects (update / merge) • Componet & Value types • Inheritance • Concurrency • Legacy databases • Performance • Common Errors / Problems
NHibernate • Origins in Java (Hiberante 2001) • First release 2004 • Last release 2.1.2 (Nov 2009) • Upcoming 3.0 release (Summer 2010) • http://nhforge.org/
Identity Map/L1 Cache ISession Unit of Work
maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.
id generators sequence increment native assigned seqhilo hilo identity foreign guid uuid.string guid.comb uuid.hex
Cascade • none • save-update • delete • delete-orphan • all • all-delete-orphan
inheritance • table per class hierarchy • table per subclass • table per concrete class
legacy • Composite primary keys • Relations on non-primary keys • Join • SQL Queries • DB Generated fields
performance • Batching • Eager loading (eliminate N+1) • Query Cache • L2 Cache
i could go on an on... • NHibernate = endless number of features
resources • http://nhforge.org/ • http://ayende.com/blog • http://www.codinginstinct.com • http://sharparchitecture.net/ Torkel.odegaard@gmail.com http://tlo.googlecode.com/svn/trunk/presentations/nhibernate_elevate