Last post Mar 04, 2012 09:28 AM by maxpayn2
Jul 08, 2011 08:43 PM|skcookie|LINK
So how did I discover these were the actual issues?
After I found the issue I made the correction in the database and updated the model from the database.
Awesome, it will work now ... NOPE!
I wish it were that simple. Instead, I had to remove the entities from the context.store and then re-add them to the edmx. For issues 2 and 3, I actually had to fully delete both the affected entity and the related entity that was part of the foreign key
constraint from the edmx and add them again. Fortunately this does not really affect any controllers, views or view models that you have already built unless you ended up renaming a field in the entities. But you would run into this issue any time you rename
a field in an entity.
I hope this help with the dreaded "An item with the same key has already been added" error from MVC3 when attempting to add a controller.
***** UPDATE Mon, Jul 11, 2011 at 9:48 AM *****
Steve Sanderson, Program Manager for .Net Stack has informed me that this issue is related to the MVC Tooling in VS 2010 and has been added to the bug list to be fixed.
*** All Content is provided As Is ***
Jan 06, 2012 03:58 PM|queej|LINK
Wow. Thanks so much! I'm a veteran developer, but new to the MS development environment. That would have taken me a long time to figure out. My problem was a duplicate key. I removed the extra key, then re-created my models and it resolved the issue.
(I had been thinking that my table was somehow conflicting with an internal MVC3 table somehow, so I was far off the track.)
Feb 25, 2012 02:50 PM|skcookie|LINK
glad it was able to help you.
Mar 04, 2012 09:28 AM|maxpayn2|LINK
Thanx alot , I have searched 3 days , your thread realy help me , I delete the Entity Data Model and re-Add it