我正在關注這個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