It's a very small code-first EF6 Project. I added a migration and updated a database successfully. Here's the output:
PM> update-database -Verbose
Using StartUp project 'ChattyServer'.
Using NuGet project 'ChattyDataModel'.
Target database is: 'ChattyDataModel.ChattyContext' (DataSource: .\SQLEXPRESS, Provider: System.Data.SqlClient, Origin: Convention).
No pending explicit migrations.
Running Seed method.
However, when I open the SQL Server Object Explorer, I can't find my database:
UPD: The app.config - which connection string should I use for LocalDb?
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
UPD: Updated the app.config, added:
connectionString="Data Source=(localdb)\ProjectsV13;Initial Catalog=master;Integrated Security=True;ConnectTimeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" />
Then created a new migration and updated a database. No changes in the SQL Server Object Explorer
UPD I changed the directory from master to chatty, created a new migration and updated the db-still can't see db in the SQL Server Object Explorer
解决方案
Firstly: You are using the Master database. Check this post to know how to set your connection string: Cant find my EF code first database.
Secondly: You didn't connect to SQLEXPRESS:
In your Server Explorer click on Connect to Database.
Then in the Server name type .\sqlexpress
Then Test Connection.
then in the Select or enter a database name you should get your
database.