I do not understand the meaning of independence

Possible duplicate:
What are the benefits of maintaining ignorance?

After some time and some questions trying to figure out the structure of the essence, I came to the conclusion that I just do not understand what the point of persistence of ignorant objects is.

As far as I can tell, the practical difference between using persistent objects and being resistant to resistance is that you use something like

Person p = Person.Load(id);
p.Active = false;
p.Save();

and the other is used along the lines

using (var context = new MyContext())
{
   Person p = context.Persons.Single(x => x.ID == id);
   p.Active = false;
   context.SaveChanges();
}

p Save() - . p, MyContext(), . , , Person Load() Save() , , , ( IPersistent, ). MyContext, , .

, - - . , . , , , , - . - , /, ?

+5
2

. , , ? .

PI , , , SQL, Persistance - . . SQL - , -job- , /. , , .

+5

, Person.Load(id), , - , - factory, , , , factory, .

, , , , OM, , , MyContext, , factory .

:

var person = onlineDbContext.Persons.Single(x=>x.Guid == myguid);

offlineDbContext.Persons.Add(person)
offlineDbContest.SaveOrUpdate();
+1

All Articles