实体框架代码第一个默认数据库位置

Bah*_*ğan 3 entity-framework visual-studio-2012

我正在尝试使用Visual Studio 2012 Express for Desktop 关注http://msdn.microsoft.com/en-us/data/jj193542上的视频教程.

我创建了POCO和DbContext,运行了一些示例查询,并且它有效.但我没有提供任何连接字符串.那么数据库在哪里?(可能是sdf或mdf文件?)

在教程中,该人使用SQL Server对象资源管理器来查看数据库,但我在VS Express中找不到该视图.

作为参考,这是生成的默认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=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>
Run Code Online (Sandbox Code Playgroud)

小智 8

"如果安装了SQL Express(包含在Visual Studio 2010)则数据库会在您的本地SQL Express实例创建(.\ SQLEXPRESS).如果未安装的SQL Express,然后代码首先会尝试使用的LocalDB((的LocalDB)\ V11 .0) - Visual Studio 2012中包含LocalDb"

有关更多信息,请访问:http://msdn.microsoft.com/en-us/data/jj591621.aspx