Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3937084
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:01:40+00:00 2026-05-20T00:01:40+00:00

I am using Entity Framework and recently came to realize the benefits of having

  • 0

I am using Entity Framework and recently came to realize the benefits of having your EF model in another project within the same solution so that I can build multiple UIs from it.

I moved it over to a new class library project and updated all the references to the entities in the web project to use the new DLL generated by the project. Everything has gone smoothly, except for one small snag. When I moved EF over to the new project, somehow it was still reading its connection string from the web.config in the web project (don’t ask me how because I have no clue).

I used "Update Model from Database" in the EF designer and it did not find a connection string (as I expected after moving it over to the new project) so I used the wizard to generate a new connection string, which it did just fine. The new connection string now resides in App.config within the class library project. The connection string in the properties window is correct now, and the designer is reading it from the App.Config. I went ahead and deleted the connection string from Web.Config in the web project.

Now when running the application I get the following error:

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

If I paste the connection string back into the Web.Config it all works just fine. I do not want to create a new EF model from scratch because it is a fairly complicated model and I did a lot of restructuring after pulling in from the DB. I have pored over the generated CS file as well as the XML in the edmx file and cannot find anything useful. Obviously for now, until I figure this out, I’m just leaving the connection string in web.config since, for whatever reason, that seems to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:01:40+00:00Added an answer on May 20, 2026 at 12:01 am

    This is by design; while the config file in the class library is what the designer will use, the configuration file of the actual application is what will get used at runtime. Whether that’s Web.config for an ASP.NET project or App.config for a Winforms or WPF project, it’s the application configuration file (or something higher up, like Machine.config) that will be used; the file in the class library is not part of the application.

    If you’re trying to provide an EF model that will work without having to specify the connection string in the application or web configuration file, then you’ll have to store the connection string some other way (you could always hard-code it) and pass it into the appropriate overload of your context’s constructor.

    My solution is generally to provide a static parameterless function on the context itself that calls this overload with the appropriate connection string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Entity Framework 4.0 in C# / .NET 4.0. Within my Entity model, I
I am working on an Entity Framework project using SQL Server 2008. We recently
I recently switched from using Linq to Sql to the Entity Framework. One of
I have been experimenting recently with Silverlight, RIA Services, and Entity Framework using .NET
I've recently started using Entity Framework migrations and noticed that the database name is
Recently our WPF/Entity Framework 4.0 application has become unstable after we began using backgroundworkers
I am using Entity Framework 4 in my project. One basic requirement is to
I recently came across following syntax of Entity Framework. Notice the where clause -
I just recently started learning and using the ADO.NET Entity Framework and ran into
I have recently been learning MVC3 using Entity Framework 4.3 and Dependancy Injection so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.