jtmg.io
jtmg.io

Reputation: 234

Entity Framework 6.4 Duplicating database name on tables ex: DatabaseName.DatabaseName.TableName

Entity Framework is duplicating database name on tables ex: DatabaseName.DatabaseName.TableName. My connection string config and web.config do not have duplication in them. Has anyone seen this before?

As you see from the error the table is:

MySqlException: Table 'nsf_erc_db.nsf_erc_db.personnel' doesn't exist

When it should be table nsf_erc_db.personnel

enter image description here

Upvotes: 1

Views: 73

Answers (1)

Visual Studio
Visual Studio

Reputation: 194

Whenever I've had issues with Entity Framework, I'll sometimes delete and re-add everything to the model. Goes without saying, but just to be safe, make sure you got a version of your project you can role back to.

To do this, select all of your tables in your model -> right click any of the tables -> select Delete from model.

Once everything is gone, right click in the empty model space and select Update model from database... and then re-add all your tables from the Add tab.

If doing that still doesn't work, you might have to manually go into the .edmx file and do some changes yourself. Messing around in the Model Browser could work too.

Upvotes: 1

Related Questions