I am using Entity Framework in a project and I am trying to attach an instance of an entity to the current context and set it’s entity state to changed. All of the examples I am seeing on how to do this are telling me that I need to use the Entry method in order to do this. Here is another question I have had where I have been directed to do this.
The problem is that when I try to write this code, the Entry method is not recognized…
using (PriorityOneEntities entities = new PriorityOneEntities())
{
entities.AttachTo(entities.UserInfoes.EntitySet.Name, userInfo);
entities.Entry(userInfo).State = EntityState.Modified;
entities.SaveChanges();
}
So I am lead to believe that I’m working with the wrong version of Entity Framework. This project is being built inside of Visual Studio 2010 with .NET 4.0. Is there a possibility that my version of Entity Framework that I’m using is out of date? If so, how do I update it?
Thanks
The easiest way to update packages is to use Nuget. Once you have it installed you can use it directly within Visual Studio to add references and it will download and set up your project. It can even notify you when updates are available for the packages you are using.