Link to home
Create AccountLog 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
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
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