I am utilizing Entity Framework 4.0 and WCF. I am new to using Entity Framework and am more familiar with NHibernate. However, I am concerned about detached instances of objects when performing an update.
I have looked on various websites where they retrieve an object, attach the instance to their context, and set all properties to be modified but this leaves two problems:
- All fields are updated in the database (not a huge problem, but adds overhead for each update statement).
- Many of the examples do not handle situations where you may have an IEnumerable property with objects that also need to be updated (this will be a requirement).
Is there a 'best practice' example of how to handle updating detached entity instances? Any guidance is greatly appreciated.