Comrades, can anyone help me out here, entity framework 5 seems not to have ApplyCurrentValues() method. Is there another way to update the database object in entity framework v5. here is what am trying to do
odc.Accounts.Attach(new Account { AccountID = account.AccountID });
odc.Accounts.ApplyCurrentValues(account);
odc.SaveChanges();
But i have been getting compile error in the ApplyCurrentValues() line
ApplyCurrentValues
is anObjectContext
API method, so first you have to gain access to the objectcontext that is wrapped in theDbContext
:Note that the wrapped context does not have members like "Accounts", so you have to use the
ObjectContext
method itself.But you can do the same using the DbContext API: