2011-04-27 3 views

답변

47

해당 사항이 없습니다. 당신은 ...와

((IObjectContextAdapter)myDbContext).ObjectContext.ApplyCurrentValues(...) 

를 ObjectContext를 얻을 ... 또는 DbEntityEntry의 유사한 방법을 사용할 수 있습니다 중 하나를 업데이트하기 전에 데이터베이스에서 일반적으로 인출 (변경 전

myDbContext.Entry(originalEntity).CurrentValues.SetValues(changedEntity); 

originalEntity이 객체를 나타내는를). 컨텍스트에 첨부해야합니다. changedEntity은 변경된 동일한 키를 가진 엔티티를 나타냅니다.

이 두 번째 방법은 아마도 EF 4.0 의 ObjectStateEntry.ApplyCurrentValues 방법과 밀접하게 관련되어 있습니다.

+0

"... CurrentValues.SetValues ​​..."는 나를 위해 일했습니다. – silverfox1948

관련 문제