This project is read-only.
1
Vote

ApplyPropertyChanges to be replaced by ApplyCurrentValues

description

FROM CODEPROJECT:
Forum: Article "Reattaching Entity Graphs with Entity Framework"
Subject: Re: EF v4
Sender: jaimebula
Date: Friday, January 14, 2011 2:49 AM

Hi,
 
Found it and compiled it,
 
But i'm getting a warning
 
Warning 1 'System.Data.Objects.ObjectContext.ApplyPropertyChanges(string, object)' is obsolete: 'Use ApplyCurrentValues instead' C:\Users\Jaime\Desktop\ef4tiers-49246\CodeProject.Data\Entity\ObjectContextExtension.cs 132 6 CodeProject.Data
 
Would you consider that updating that line of code is safe?
 
object attachedEntity = context.GetObjectByKey(entityKey);
if (applyPropertyChanges)
context.ApplyPropertyChanges(entityKey.EntitySetName, entity);
return attachedEntity;
 
to
 
object attachedEntity = context.GetObjectByKey(entityKey);
if (applyPropertyChanges)
context.ApplyCurrentValues(entityKey.EntitySetName, entity);
return attachedEntity;
 
Best Regards.
 
Jaime

comments

codetuner wrote Jan 14, 2011 at 12:15 PM

ApplyPropertyChanges was renamed to ApplyCurrentValues in EF4. The behavior of the operations is identical, so replacing the method is safe.

wrote Feb 13, 2013 at 9:44 PM