实体框架4.3:“更新数据库”时的配置文件分开 [英] Entity Framework 4.3: 'update-database' when configuration files are separated
问题描述
移动到EF 4.3
AutomaticMigrationsEnabled = true;
在的web.config
具有以下设置:
<appSettings configSource="appSettings.config" />
<connectionStrings configSource="connectionStrings.config" />
在包管理器控制台执行
update-database -verbose
和得到了以下错误:
System.Configuration.ConfigurationErrorsException: Unable to open configSource file 'connectionStrings.config'
该错误是可以理解的:它试图从工作目录是不是根项目目录,其中 connectionStrings.config打开
文件存在。 connectionStrings.config
文件
The error is understandable: it tries to open connectionStrings.config
file from the working directory which is not the root project directory where connectionStrings.config
file exists.
如果connectionStrings.config和appSettings.config内容被移动到web.config像一个魅力的所有作品。
If connectionStrings.config and appSettings.config content to be moved to the web.config all works like a charm.
时的一个bug一个可以在某种程度上解决了吗?
Is it a bug a it can be solved somehow?
推荐答案
好像这个错误是<一个href="http://blogs.msdn.com/b/adonet/archive/2012/02/29/ef4-3-1-and-ef5-beta-1-available-on-nuget.aspx"相对=nofollow>固定4.3.1 。
有关configsource在配置文件中启用的支持时使用 code首先迁移。
Enabled support for configsource in configuration files when using Code First Migrations.
这篇关于实体框架4.3:“更新数据库”时的配置文件分开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!