title: I don't understand the point of persistence independence
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/905498/what-are-the-benefits-of-persistence-ignorance">What are the benefits of Persistence Ignorance?</a>  </p>
  </blockquote>
  
  
  
  <p>After some time and some questions trying to figure out the entity framework, I've come to the conclusion that I just don't get what the point of persistence ignorant objects is.</p>
  
  <p>As best as I can tell, the practical difference between using persistence-aware objects and persistance-ignorant ones is that one gets used something like </p>
  
  <pre><code>Person p = Person.Load(id);
  p.Active = false;
  p.Save();
  </code></pre>
  
  <p>and the other is used along the lines of</p>
  
  <pre><code>using (var context = new MyContext())
  {
     Person p = context.Persons.Single(x =&gt; x.ID == id);
     p.Active = false;
     context.SaveChanges();
  }
  </code></pre>
  
  <p>In the first case, I can return <code>p</code>, and call <code>Save()</code> at some later point.  In the latter, I could return <code>p</code>, but I'd need to put it into a new <code>MyContext()</code> to save it.  In the first case, assuming that Person inherits Load() and Save() from some base object which actually handles the database logic, if I wanted to change the persistence, it would just involve changing that base object (or even just have an <code>IPersistent</code> interface which multiple base classes can implement to access multiple stores).  In the latter, I would need to change every instance of <code>MyContext</code> if the persistence layer changed, and it would be hideously complicated to do piecemeal.  </p>
  
  <p>My impression is that persistence-ignorance is a good thing.  I just can't understand why.  It seems like it's much more complicated to set up, work with, change wholesale and change piecemeal, with no advantage for that complication.  Am I just missing something important, or is my entire understanding of what persistence-aware/ignorant means flawed?</p>