edmx 连接字符串

发布于 2024-10-08 03:07:16 字数 105 浏览 0 评论 0原文

我正在开发一个使用 edmx 进行数据访问的应用程序。
我意识到每个 edmx 文件在配置文件中都有自己的连接字符串。
有没有一种方法可以为所有 edmx 文件共享一个连接字符串?

I am developing an application that uses edmx for dataaccess.
I realized that each edmx file have its own connection string in the configuration file.
Is there a way to share one connection string for all the edmx files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦断已成空 2024-10-15 03:07:17

不 - 没有。

并且有充分的理由。实体框架中的连接字符串包含的内容远多于常规连接字符串(例如数据源/数据库名称)。

它包含有关模型不同组件的重要信息,包括模型独有的 CSDL。

也许您可以解释一下,如果您计划在不同的 EDMX 之间共享连接字符串,那么为什么首先需要单独的 EDMX?

如果您正在寻找动态创建连接字符串的方法,请查看EntityConnectionStringBuilder。

No - there isn't.

And for good reason. The connection string in Entity Framework contains much more than regular connection strings (e.g data source / database name).

It contains crucial information about the different components of the model, including the CSDL, which is unique to the model.

Perhaps you could explain if you are planning to share a connection string between different EDMX's, then why do you need seperate EDMX's in the first place?

If your looking at a way to dynamically create a connection string then look at EntityConnectionStringBuilder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文