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
This means that the Entity Framework connection string isn't found in the Web.config or App.config for your project. Note that this connection string is not the same as the DB connection string.
Well, I found a solution for this but, I don't know is it the optimum or not. I put the connection string in the app.config through Settings file, and change the named connection in the constructor for the EF model designer to read this connection as the following
public InvDB() : base(Properties.Settings.Default.InvDB, "InvDB")
but this solution, you've to make this change every time you open the EF designer, but it's good for now.
精彩评论