Hi
I am trying to attach an entity to the ObjectContext.
When I do so, the following InvalidOperationException is thrown:
An object with the same key already exists in the ObjectStateManager.
The ObjectStateManager cannot track multiple objects with the same key.
I checked in the object state manager and the item does not exist:
//D...
Should I avoid using Include in queries, or I can rely on the EDM that when it creates the query it excludes from the query items that already exist in the OSM?
...
How to update ALL the dirty entities from the data store, and reset their changed values to the original store value?
The method ObjectContext.Refresh requires as a parameter the entities to be refreshed.
...
I have a edited RESTful wizard based upon Shoulders of Giants | A RESTful Wizard Using ASP.Net MVC… Perhaps? . This wizard has a CANCEL button which, when pressed, fires the code below.
// If the user cancels, drop out altogether
if (!string.IsNullOrEmpty(CANCEL_BUTTON)) {
Session.Remove(VACANCYWIZARD_SESSION_KEY);
repository...
Hi Guys,
I have an Entity Framework 4.0 model implemented with pure POCO's (no code generation, no self-tracking entities, just plain old CLR objects).
Now, here is some code i have in my UI to perform an UPDATE:
[HttpPost]
public ActionResult UpdatePerson(Person person)
{
repository.Attach(person);
unitOfWork.Commit();
}
Es...