Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with connectionstring and entityframework

I have a database (sql 2008 mdf file), a class library project with an edmx file, created with the wizard. So the connection string is also made by the wizard. This project is on a teamfoundation server.

I can use all the wizard made objects when coding.

But when i run the program and I try to make an entityContainerName, the program crashes and gives this error:

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

on this line: public TestEntities() : base("name=TestEntities", "TestEntities")

How can I solve this problem or what am I doing wrong?

like image 496
Masna Avatar asked Aug 25 '26 11:08

Masna


2 Answers

You need to copy the connection string from the class library's config file into the config file of the application that is actually running.

like image 178
Mant101 Avatar answered Aug 27 '26 02:08

Mant101


First: delete your model, second: delete all the connectionstrings in your app.config.

Then recreate the model. This should set everything back to default.

like image 30
Snake Avatar answered Aug 27 '26 01:08

Snake



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!