Domain Model James Kovacs JamesKovacscom jkovacspostharvardedu POCO Plain Old CLR Object No persistencerelated code Only business logic public class Customer public string Name get ID: 311883
Download Presentation The PPT/PDF document "The Persistence Ignorant" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
The Persistence IgnorantDomain Model
James KovacsJamesKovacs.comjkovacs@post.harvard.eduSlide2
POCO – Plain Old CLR ObjectNo persistence-related codeOnly business logicpublic class Customer { public string Name { get; }
public Location Address { get; } public IList<Order> Orders { get; } public void AddOrder(Order o) {}} What is Persistence Ignorance?Slide3
Separation of concernsSingle responsibilityLoose couplingTestabilityRe-useWhy is Persistence Ignorance Important?Slide4
NHibernate and PINo special persistence-related base classNo marker or callback interfacesNo persistence-related attributesNHibernate
domain class:public class Customer { public string Name { get; } public Location Address { get; } public IList<Order> Orders { get; } public void AddOrder(Order o) {}} Slide5
NHibernate API
ConfigurationClass for bootstrapping NHibernateISessionFactoryFactory for creating sessionsISessionRoughly analogous to a database connectionITransactionAbstracts underlying transaction semanticsIQueryString-based query API
ICriteria
Object-based query APISlide6
PPTSlide7
ResourcesNHibernate (http://www.nhibernate.org)NHibernate in Action by Pierre Henri
Kuaté, et al.NHibernate Plugin (http://sourceforge.net/projects/nhibernateaddin)Castle Active Record (http://www.castleproject.org)Active Writer (http://altinoren.com/activewriter/)Domain-Driven Design by Eric EvansApplying Domain-Driven Design and Patterns by Jimmy NilssonSlide8
QuestionsJames Kovacs
JamesKovacs.comjkovacs@post.harvard.edu