Link to home
Start Free TrialLog in
Avatar of sbornstein2
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.ChangeObjectState(address, EntityState.Modified);
context.SaveChanges();



ASKER CERTIFIED SOLUTION
Avatar of Neun123
Neun123

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sbornstein2
sbornstein2

ASKER

That is not available UpdateObject:

  [OperationContract]
        public void SaveCustomerAddress(CustomerAddress address)
        {
            using (var context = new AdventureWorksEntities())
            {
                context.Attach(address);
                context.UpdateObject //doesn't exist
            }
        }
issue was I was targeting the 3.5 framework instead of 4.  Thanks