从TFS下载并更改配置文件后,为什么EDMX文件不会命中数据? [英] Why would an EDMX file not hit data when dowloaded from TFS and config file is changed?

查看:50
本文介绍了从TFS下载并更改配置文件后,为什么EDMX文件不会命中数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有重复的数据库服务器,具体取决于在客户端站点还是在办公室.

I have duplicate db servers depending on if at client site or at office. 

在我的配置文件中,每个服务器都有一对连接字符串,其中的名称已更改以保护差异.

I have a pair of Connection strings one for each server in my config file where the name is changed to protect the difference.

为什么现在在客户端站点上不能正常使用数据库|我希望有桌子吗?

Why will working at client site now fail to actually use the db | table I expect to be there?

 

 

推荐答案

实体框架生成的ObjectContext派生类在您使用时根据其名称在配置文件中选择一个连接字符串.调用无参数构造函数.但是,从您的帖子中尚不清楚您要更改的内容 ObjectContext以根据您所在的站点选择不同的连接字符串.您可能需要更改代码以指向配置文件中的正确连接字符串,或者需要交换连接字符串的名称. 在配置文件中,以便EF可以选择正确的文件.
The ObjectContext-derived class that the Entity Framework generates chooses a connection string in the configuration file based on its name when you call the parameterless constructor. However, it's not clear from your post what you change in order for the ObjectContext to pick up a different connection string depending on which site you are on. You would either need to change the code to point to the correct connection string in the configuration file, or you need to swap the names of the connection strings in the configuration file so EF will pick up the right one.


这篇关于从TFS下载并更改配置文件后,为什么EDMX文件不会命中数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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