Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework Code First Default Database Location

I am trying to follow the video tutorial on http://msdn.microsoft.com/en-us/data/jj193542 using Visual Studio 2012 Express for Desktop.

I created POCO's, and a DbContext, ran some sample queries and it worked. But I did not provide any connection string. So where is the database? (sdf or mdf file maybe?)

During the tutorial the guy uses SQL Server Object Explorer to view the database, but I couldn't find that view in VS Express.

For reference, here is the default App.config that gets generated.

<?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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>
like image 741
Bahadır Yağan Avatar asked Jul 13 '26 19:07

Bahadır Yağan


1 Answers

"If SQL Express is installed (included in Visual Studio 2010) then the database is created on your local SQL Express instance (.\SQLEXPRESS). If SQL Express is not installed then Code First will try and use LocalDb ((localdb)\v11.0) - LocalDb is included with Visual Studio 2012"

For more information : http://msdn.microsoft.com/en-us/data/jj591621.aspx

like image 78
chicco Avatar answered Jul 18 '26 06:07

chicco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!