MVC5/EF6: Object cannot be deleted because it was not found in the ObjectStateManager?

asp.net-mvc asp.net-mvc-5 c# entity-framework-6 objectstatemanager

Accepted Answer

The issue is that you are utilizing 2 instead.DbContext they cannot follow each other's Entities while they are here.

To have both, you must alter your Controller code.db and UserManager the context instance references are the same

public UserManagementController()
{
    this.db = context.Get<ApplicationDbContext>();
}
4
6/18/2014 6:41:59 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow