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

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

问题描述

我最近不得不编辑我的 app.config 文件来更改实体框架数据模型(.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 设计器的属性窗口中保持禁用状态.如果可以(在 app.config 中),我喜欢避免手动编辑 XML,所以我想知道是否有办法返回原始向导屏幕以更改连接字符串并让该工具编辑 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天全站免登陆