Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.ArgumentException while updating Model from Database

Our Application is an MVC Application. We are using Entity Framework. When I am updating the model to add a table from the database. I am recieving an exception and it says

"An exception of type 'System.ArgumentException' occured while attempting to update from the database. The exception message is: 'An entry with the same key already exists'."

I am not able to figure out what is the problem. Can I have a solution to get over the problem.

like image 619
sunny Avatar asked Jun 15 '11 16:06

sunny


People also ask

How do I update my EDMX model?

In the Model Browser, right-click the . edmx file and select Update Model from Database. Expand the Tables, Views, and Stored Procedures nodes, and check the objects you want to add to the . edmx file.

How do I update my Entity Framework Database first?

Right-click anywhere on the design surface, and select Update Model from Database. In the Update Wizard, select the Refresh tab and then select Tables > dbo > Student. Click Finish.


1 Answers

I had it just as you did. You probably have two identical nodes: EntitySetMapping. You should remove one and everything will be ok.

like image 171
Tazos333 Avatar answered Sep 27 '22 19:09

Tazos333