Download presentation
Presentation is loading. Please wait.
Published bySheila Baldwin Modified over 9 years ago
1
The Persistence Ignorant Domain Model James Kovacs JamesKovacs.comjkovacs@post.harvard.edu
2
POCO – Plain Old CLR Object No persistence-related code Only business logic public class Customer { public string Name { get; } public Location Address { get; } public IList Orders { get; } public void AddOrder(Order o) {} } What is Persistence Ignorance?
3
Separation of concerns Single responsibility Loose coupling Testability Re-use Why is Persistence Ignorance Important?
4
NHibernate and PI No special persistence-related base class No marker or callback interfaces No persistence-related attributes NHibernate domain class: public class Customer { public string Name { get; } public Location Address { get; } public IList Orders { get; } public void AddOrder(Order o) {} }
5
NHibernate API ConfigurationClass for bootstrapping NHibernate ISessionFactoryFactory for creating sessions ISessionRoughly analogous to a database connection ITransactionAbstracts underlying transaction semantics IQueryString-based query API ICriteriaObject-based query API
7
Resources NHibernate (http://www.nhibernate.org)http://www.nhibernate.org NHibernate in Action by Pierre Henri Kuaté, et al. NHibernate Plugin (http://sourceforge.net/projects/nhibernateaddin)http://sourceforge.net/projects/nhibernateaddin Castle Active Record (http://www.castleproject.org)http://www.castleproject.org Active Writer (http://altinoren.com/activewriter/)http://altinoren.com/activewriter/ Domain-Driven Design by Eric Evans Applying Domain-Driven Design and Patterns by Jimmy Nilsson
8
Questions James Kovacs JamesKovacs.comjkovacs@post.harvard.edu
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.