实体框架4.3:“更新数据库”时的配置文件分开配置文件、实体、框架、数据库

由网友(站在巴黎铁塔上等日出)分享简介:移动到EF 4.3 AutomaticMigrationsEnabled = true;在的web.config 具有以下设置:移动到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?

推荐答案

好像这个错误是固定4.3.1 。

有关configsource在配置文件中启用的支持时使用   code首先迁移。

Enabled support for configsource in configuration files when using Code First Migrations.

阅读全文

相关推荐

最新文章