我正在关注这个tutorial来创建一个代码优先数据库。
安装EF和创造它说,这些第一基本类之后:代码优先的方法,数据库的位置和所有实例(v110等)
运行应用程序,你会看到一个 MigrationsCodeDemo.BlogContext数据库为您创建。
那么,我有安装了所有SQL Server的VS2013 Pro(完全安装VS2013 Pro)。
现在,您可以从下面的图像中看到,运行该程序后,我找不到数据库,正如教程提示的那样。当我尝试执行本教程的迁移部分时,我的确得到了它应该得到的错误,这意味着数据库实际上已经创建。我只是无法找到它。
它位于何处?
编辑:添加的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>
您可以将文件'web.config'的''元素的内容添加到您的问题中。 –
spender
2014-09-02 23:12:54
你有没有试过在数据库刷新你的对象浏览器?右键单击数据库并单击刷新。 – Saechel 2014-09-02 23:23:42
@spender我添加了App.config文件,因为我在这里使用了WPF。 – QuantumHive 2014-09-03 09:29:00