I am doing Microsoft's MVC getting started tutorial:
Getting Started with Entity Framework 6 Code First using MVC 5.
This includes the creation of a code first database.
It all works fine, but I am not able to find my database.
This is my ConnectionString
:
<add name="MovieDBContext" connectionString="Data Source=.\SQLEXPRESS; Integrated Security=True" providerName="System.Data.SqlClient"/>
If I debug my index Method the connection is as follow:
Data Source=.\SQLEXPRESS; Integrated Security=True
But there is no Database in my SQLEXPRESS Instance, I have checked it with SQL Server Management Studio.
I also cant find anything if I search my filesystem for *.mdf
.
App_Data
in my Project is Empty...
But all CRUD operations are working fine, there has to be something.
The only way I can see that table is to connect to .\SQLEXPRESS
via the Visual Studio Server Explorer. But where is this physically located? Why cant I see the table if I connect to .\SQLEXPRESS
via SQL Server Management Studio?
Any idea?
You didn't specify the Initial Catalog
in your connection string so probably you are using the Master
database.
You need to specify the Initial catalog
like this:
<add name="MovieDBContext"
connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=yourDBName;Integrated Security=True"
providerName="System.Data.SqlClient"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With