EF4 - Context.Entry isn't available to change an Entity State
问题 I use an EDMX schema as my context. On a previous project where I didn't use a schema, I could change the entity state like this: public void SaveProduct(Product product) { if (product.ProductID == 0) context.Products.Add(product); else context.Entry(product).State = EntityState.Modified; context.SaveChanges(); } But in this project, I don't see .Entry in my intellisense (and it won't suggest a namespace reference if I just type it in). I tried to modify an entity ans save it. It worked