EF: ApplyPropertyChanges
От: FreddieM  
Дата: 25.10.08 18:30
Оценка:
Объясните плз. логику с ApplyPropertyChanges... Я просто хочу приаттачить объект как modified, но не получается...

using (var ctx = new SAMPLE_DBEntities())
{
    Department newDep = new Department();
    newDep.Name = "New Dep4";

    newDep.Id = 1;
    newDep.EntityKey = new System.Data.EntityKey("SAMPLE_DBEntities.Department", "Id", 1);
    
    ctx.Attach(newDep);
    ctx.ApplyPropertyChanges("SAMPLE_DBEntities.Department", newDep);
    ctx.SaveChanges();
}
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.