代码第一次迁移 - 它将使用什么连接字符串? [英] Code first migrations - what connection string will it use?

查看:133
本文介绍了代码第一次迁移 - 它将使用什么连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码首次迁移对我来说一直很好。我有一个服务项目和一个wpf项目。该模型在由wpf项目引用的服务项目中。更新数据库在服务项目上完成,但使用wpf项目中的连接字符串。我现在添加一个也参考服务项目的Web项目。所以现在app.config中有一个连接字符串,而web.config中有一个连接字符串,它将使用哪一个?

Code first migrations have been working very well for me. I have a services project and a wpf project. The model is in the services project which is referenced by the wpf project. Update-database is done on the services project, but uses connection string from the wpf project. I now add a web project which also references the service project. So now that there is a connection string in the app.config and there is one in the web.config, which one will it use?

推荐答案

在我的方案中,服务项目中的app.config将被忽略。代码第一次迁移将使用WPF项目的app.config或web项目的web.config,根据哪个选择作为启动项目。

In my scenario, the app.config in the services project is ignored. Code first migrations will use either the app.config from the WPF project or the web.config on the web project, depending which is selected as the startup project.

这篇关于代码第一次迁移 - 它将使用什么连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆