1

I'm building multi-project Application where some UserControl, the user control has a Entitymodel object (myDBContainer db = new myDBContainer()), when i drop my user control on my a form i got the following designer error

The specified connectionis either not found in the configuration, not intended to be used with the entityclient provider

4

2 回答 2

1

这意味着在您的项目的 Web.config 或 App.config 中找不到实体框架连接字符串。请注意,此连接字符串与 DB 连接字符串不同。

于 2010-01-18T13:13:01.860 回答
0

好吧,我找到了一个解决方案,但是,我不知道它是否是最佳的。我通过设置文件将连接字符串放在 app.config 中,并在构造函数中更改命名连接,以便 EF 模型设计器读取此连接,如下所示

public InvDB() : base(Properties.Settings.Default.InvDB, "InvDB")

但是这个解决方案,每次打开 EF 设计器时都必须进行此更改,但现在这很好。

于 2010-01-24T09:01:40.103 回答