Code-First, the location of the database and all instances (v110, etc.),

I follow this tutorial to create a Code-First database.
After installing EF and creating the first base classes, he says:

Launch the application and you will see that the MigrationsCodeDemo.BlogContext Database is created for you.

Well, I have VS2013 Pro with all installed SQL servers (full installation of VS2013 Pro).
Now, as you can see from the image below, I can’t find my database after starting the program, as the tutorial suggests. When I try to complete part of the migration from the tutorial, I really get the error that it should get, implying that somewhere the database was actually created. I just can't find him.
Where is he located?
enter image description here
Edit: Added App.config

<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> <parameters> <parameter value="mssqllocaldb" /> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> </entityFramework> </configuration> 
+5
source share
2 answers

The physical core database files are in

 C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0 

DB files are simply located in C:\Users\<user>

You can also connect to localdb using SSMS using the server (localdb) \ v11.0 and delete the database there.

The official documentation is here http://msdn.microsoft.com/en-AU/library/hh510202.aspx

Edit by QuantumHive:
I finally realized that the database can be found in the MSSqlLocalDb instance, which, by default, the Entity Framework is added to my App.config . Now I have a database visualization in Visual Studio:
enter image description here
I assume these lessons are old and refer to an instance of v11.0, which perhaps an earlier version of EF added by default at that time.

+15
source

You are connected to the localDb \ Projects instance, and not to localDb \ v11.0, you only need to click "Add Sql Server" and insert '(localDb) \ v11.0' into the server name, then connect, and you're done.

0
source

Source: https://habr.com/ru/post/1201681/


All Articles