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();



C#ASP.NET.NET Programming

Avatar of undefined
Last Comment
sbornstein2
ASKER CERTIFIED SOLUTION
Avatar of Neun123
Neun123

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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
            }
        }
Avatar of sbornstein2
sbornstein2

ASKER

issue was I was targeting the 3.5 framework instead of 4.  Thanks
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo