如何编辑实体框架连接字符串? [英] How should I edit an Entity Framework connection string?

查看:213
本文介绍了如何编辑实体框架连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近不得不编辑我的app.config文件来更改Entity Framework数据模型( .edmx 文件)的连接字符串。但是我想知道:有没有办法使用设计器编辑EF连接字符串?

I recently had to edit my app.config file to change the connection string for an Entity Framework data model (.edmx file). But I'd like to know: Is there a way to edit the EF connection string using the designer?

原来的连接字符串是自动的由实体数据模型向导生成。连接字符串不能被更改 - 它在.edmx设计器的属性窗口中保持禁用。我喜欢避免手动编辑XML(在app.config中),所以我想知道是否有办法回到原始的向导屏幕,使连接字符串更改,并让工具编辑app.config文件对于我来说,

The original connection string is auto-generated by the Entity Data Model wizard. The connection string then cannot be changed - it remains disabled in the properties window of the .edmx designer. I like to avoid editing XML by hand if I can (in app.config), so I was wondering if there is a way to get back into the original wizard screen to make connection string changes and let the tool edit the app.config file for me.

推荐答案

如果从 app.config 文件,重新运行实体数据模型向导将指导您构建新的连接。

If you remove the connection string from the app.config file, re-running the entity Data Model wizard will guide you to build a new connection.

这篇关于如何编辑实体框架连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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