How to properly delete and re-add Entity Data Model

David picture David · Jan 6, 2011 · Viewed 22.8k times · Source

newbie to Entity Framework here. Using VS 2010 and SQL Server 2008 express DB.

I was having trouble refreshing an Entity Data Model after adding new tables. So, I followed a suggestion I found here to just delete and regenerate the model.

I get to the "Choose Your Data Connection" section of the Entity Data Model Wizard and "Save entity connection settings in Web.config as:" is checked. However, my existing name has a 1 appended to it. For example MyDatabaseEntities is now MyDatabaseEntities1. Of course, I don't want the "1" appended. I killed the existing connection string in Web.config and removed all references to that name in my solution. Yet when I try to continue I'm presented with the following error:

"'MyDatabaseEntites' conflicts with an existing property name in the Application Settings. Please choose a different name"

I can't find a reference to that name anywhere in the solution. I can uncheck that option and it will continue, but it STILL won't add two of the tables in the database. Next, I completely shut everything down, rebooted, and tried again. This time I didn't get the error above, but two of my three new tables still do not get added to the edmx model.

Any ideas are appreciated. Also this seems like it's still pretty buggy even in VS2010/.NET 4. Help restore my faith...I feel like abandoning Entity Framework at this point. Based on my experience so far and some of the other issues posted here, I feel like I'm going to spend more time chasing Entity Framework strangeness than writing useful code.

UPDATE: I found a resolution. The designer doesn't display errors. You have have to look in the native XML (edmx file) to see the errors. See here: ADO.NET Entity Framework: Update Wizard will not add tables

Answer

techvslife picture techvslife · Mar 25, 2012

The error is caused by leftover connection strings in settings in "App.Config" file (see solution explorer) and it's in this section: "connectionStrings" (surrounded by angle brackets)

Just delete it from there.