RSS

What is Persistence Ignorance?

06 Aug

In Entity Framework, Persistence Ignorance is defined as (MSDN):

An object that does not contain any logic that is related to data storage.

In his book “Applying Domain Driven Design and Patterns”, Jimmy Nilsson (also refers it as POCOs) defines as:

…ordinary classes where you focus on the business problem at hand without adding stuff for infrastructure-related reasons. … The classes should focus on the business problem at hand. Nothing else should be in the classes in the Domain Model.

Persistence ignorance object, or POCO, looks like this (notice there is no any constructor or method in this class):

public partial class Task
{
    public int Id { get; set; }
    public string Title { get; set; }
    public string Note { get; set; }
    public DateTime DueDate { get; set; }
    public DateTime EndDate { get; set; }
    public int PriorityId { get; set; }
    public int StatusId { get; set; }
    public int ResponsibilityId { get; set; }
}
Advertisements
 
1 Comment

Posted by on August 6, 2011 in General

 

Tags: , ,

One response to “What is Persistence Ignorance?

  1. altaf

    May 4, 2012 at 1:16 pm

    Good Define … good job

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: