1 / 8

The Persistence Ignorant Domain Model

The Persistence Ignorant Domain Model. James Kovacs JamesKovacs.com jkovacs@post.harvard.edu. What is Persistence Ignorance?. POCO – Plain Old CLR Object No persistence-related code Only business logic public class Customer {      public string Name { get; }

evania
Download Presentation

The Persistence Ignorant Domain Model

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Persistence IgnorantDomain Model James Kovacs JamesKovacs.com jkovacs@post.harvard.edu

  2. What is Persistence Ignorance? • 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<Order> Orders { get; }     public void AddOrder(Order o) {} }

  3. Why is Persistence Ignorance Important? • Separation of concerns • Single responsibility • Loose coupling • Testability • Re-use

  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<Order> Orders { get; }     public void AddOrder(Order o) {} }

  5. NHibernate API

  6. PPT

  7. Resources • NHibernate (http://www.nhibernate.org) • NHibernate in Action by Pierre Henri Kuaté, et al. • NHibernatePlugin (http://sourceforge.net/projects/nhibernateaddin) • Castle Active Record (http://www.castleproject.org) • Active Writer (http://altinoren.com/activewriter/) • Domain-Driven Design by Eric Evans • Applying Domain-Driven Design and Patterns by Jimmy Nilsson

  8. Questions James Kovacs JamesKovacs.com jkovacs@post.harvard.edu

More Related