I am using MVC 4 and C# 4.5 with EntityFramework 4.
I have setup a simple Many to Many table:
tblAdminUser -> tblAdminUserRole <- tblAdminRole
When I try to add a role to the admin user, I get the following error:
"Unable to update the EntitySet 'tblAdminUserRole' because it has a DefiningQuery and no element exists in the element to support the current operation."
The code I am using is:
this.Role = new tblAdminRole()
{
Name = "__role__",
};
context.tblAdminRoles.Add(this.Role);
context.SaveChanges();
this.AdminUser.tblAdminRoles.Add(this.Role);
context.SaveChanges();