title: Entity Framework v1 and Cached POCO update
body: <p>I am using EF v1 and Velocity cache in my .NET 3.5 application. My cached objects are a representation of the Entity model in database. So I decided to use EF v1 with POCO adapters. So there's an entity access layer that reads the object from cache and if not present reads it from database and caches it immediately. Now in the use case where a update is required, the dirty POCO needs to be updated in database. Now I cant directly use the POCO adapters and proxies here since they need a backing objects that are tracking changes. I never hydrated the adapter object from the framework so change detection is not happening. The easiest option I see is to:   </p>
  
  <ol>
  <li>Read the entity before update. Set the adapter values from POCO. Let change detection take its course. This does a select before every update which could be costly given many associated entities.     </li>
  <li>Create a new Entity object. Set the Entity key and properties from POCO. Save Changes. This does unnecessary writes even when property/associated entity has not been changed.    </li>
  </ol>
  
  <p>I hope I was clear in the problem statement. Please suggest.</p>