sbornstein2
asked on
Entity Framework VS2010 context.objectstatemanager."CHANGEOBJECTSTATE" doesn't exist?
I am trying something in VS2010 where I attach a entity to my context but then I try to simply do a ChangeObjectState and it doesn't exist anymore it seems. How do I update a object? I used to just do the following:
context.attach(address);
context.ObjectStateManager .ChangeObj ectState(a ddress, EntityState.Modified);
context.SaveChanges();
context.attach(address);
context.ObjectStateManager
context.SaveChanges();
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
issue was I was targeting the 3.5 framework instead of 4. Thanks
ASKER
[OperationContract]
public void SaveCustomerAddress(Custom
{
using (var context = new AdventureWorksEntities())
{
context.Attach(address);
context.UpdateObject //doesn't exist
}
}