在我的DAL項目中我有從ii使用的存儲庫。我已經重構項目有點和現在收集來自庫我收到提示在應用程序配置文件中找不到名爲'MyAppDbContext'的連接字符串
數據「沒有連接字符串名爲‘MyAppDbContext’可以在 應用程序配置文件中找到。」
- 爲什麼我收到此錯誤信息:
我在那裏生活的倉庫有以下方面
<?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>
<connectionStrings>
<add name="MyAppDbContext" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=MyApp.DAL.MyAppDbContext;Integrated Security=True;AttachDBFilename=MyApp.DAL.MyAppDbContext.mdf" providerName="System.Data.SqlClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
其實我有兩個問題上的App.config同一項目(DAL): 「在應用程序配置文件中找不到名爲'MyAppDbContext'的連接字符串。」
你是什麼意思「使用數據庫從App_Data」?使用存儲在那裏的連接字符串? –
我希望物理上將db移動到App_Data並在conn中設置此位置。串。 – user1765862
@ user1765862查看ms sql compact edition或sqlite。我認爲這將是更好的解決方案本地數據庫在App_Data –