In a new development project using Entity Framework 6.0 code-first I had to update my models quite a bit. The update script that was automatically generated using Add-Migration in Package Manager Console got quite complex so I decided to start over. To do this I deleted the database from localhost and deleted the Migrations folder in the project. However when I re-ran the Add-Migration-command I got the following message and the same update-script was generated again:
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration.
I was fairly certain this was because __MigrationHistory-table was still there somehow. I went into the database again but nothing had been created and the database was still gone.
Connection string used in web.config:
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=localhost;Initial Catalog=WebApp;Integrated Security=sspi;Pooling=false;"
providerName="System.Data.SqlClient" />
</connectionStrings>
I then checked my processes and saw two versions of the sqlservr.exe-process and LocalDb came to mind. I connected to (LocalDb)\MSSQLLocalDB and there was a new database named 'DefaultConnection' with all tables for the project. When I deleted this database I got a fresh script from the Add-Migration-command. Somewhere along the line a switch must have been made since I'm 100% certain I have been working against the SQL Server Express host at some time (All tables prior to the update script where there when I deleted the database) and for all my other project localhost works with Data Source=localhost. I can't understand why the database name is DefaultConnection instead of WebApp either. Connecting to localhost, the database name was WebApp. Has anyone experienced this before?
