Code-First approach, location of database and all instances (v110, etc)
The physical master database files are at
C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0
The DB files are simply in C:\Users\<user>
You can also connect to localdb using SSMS by using server (localdb)\v11.0 and delete the database from there.
The official documentation is here http://msdn.microsoft.com/en-AU/library/hh510202.aspx
Edit by QuantumHive:
I finally figured out that the Database can be found in the instance called MSSqlLocalDb which Entity Framework added by default in my App.config. I now have a visualization of the database in Visual Studio:
I'm guessing those tutorials are old and referring to the v11.0 instance, which perhaps and older version of EF added that by default at the time.
QuantumHive
Updated on July 07, 2022Comments
-
QuantumHive almost 2 years
I'm following this tutorial to create a Code-First Database.
After installing EF and creating those first basic classes it says:Run your application and you will see that a MigrationsCodeDemo.BlogContext database is created for you.
Well, I have VS2013 Pro with all the SQL Servers installed (full installation of VS2013 Pro).
Now as you can see from the image below, I can't find my database after running the program as the tutorial is suggesting. When I try to do the migrations part of the tutorial, I indeed get the error it supposed to get, implying that somewhere the database actually has been created. I just am not able to find it.
Where is it located?
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>
-
QuantumHive over 9 yearsOMG! Found it! It was indeed in
C:\Users\<user>
. I was searching the entire internet for this small answer. Where is the official documentation for this sneaky little thing? -
QuantumHive over 9 yearsAlso what bothers me so much is that looking at all those MSDN walkthroughs they all say that you have to connect with either localdb or sqlexpress depending on which is installed, like here: msdn.microsoft.com/en-us/data/jj193542.aspx The annoying thing is, they don't tell you these basic things. Which led me some frustrating hours of searching. Thanks, I love you Pratik! <3
-
QuantumHive over 9 yearsI'm also wondering, why isn't the database added to SQL Server Object Explorer as the tutorials all are suggesting?
-
Kioshiki almost 9 yearsthe questions already been answered but I just had this issue recently too. There's a reason it's different. the v11.0 part is SQL Server 2012 while mysqllocaldb is SQL Server 2014 (Source: msdn.microsoft.com/en-us/library/…)