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

  • Home
  • SEARCH
  • 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 8392659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:34:11+00:00 2026-06-09T19:34:11+00:00

My solution has two projects. A class library to generate data from an Entity

  • 0

My solution has two projects. A class library to generate data from an Entity Framework .edmx file via a repository class. The App.Config file connectionString matches the Web.config in my second ASP.Net 4.0 web forms project.

I modify BOTH connectionStrings to point to the test database (DataSource=TestDB) when deployed to the test server. When deployed to the live site I modify both to point to the live database (DataSource=LiveDB).

At the top of Site.Master I display in red letters “You are connected to the TEST database” in a label control. I conditionally toggle the .Visible property of the label if (context.Connection.DataSource.Contains("TestDB"))

During development I noticed something strange. When Web.config points to TestDB, if I forget to make App.config match (and it points to LiveDB) the “connected to TEST” warning appears but data from LiveDB displays.

This tells me the repository (class library) uses App.Config but a data context created in the web forms project uses the Web.config connectionString. Is that correct? I’m concerned that live data will be updated incorrectly if I deploy to the test site and forget to point App.Config to TestDB.

So my question is, in this scenario… What is the best way to display a notification “connected to test database” that is always accurate?

  • 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-06-09T19:34:13+00:00Added an answer on June 9, 2026 at 7:34 pm

    By default a class library will not be using any app.config file.

    It would use the .config file that is in the context of the application using it – in the case of a web application that would be the web.config file.

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

Sidebar

Related Questions

I have two projects in my Solution. One implements my business logic and has
This question has two parts (maybe one solution?): Sample vectors from a sparse matrix
I have a Solution that has two class libraries. I'm trying to convert the
I'm writing a two-project solution with a class library designed for re-use, and an
I am currently developing a C# WPF project. The solution has two projects, one
I'm working on a solution that has two projects: One ASP.NET web application, and
I am working in a project that has two main parts: a class library
I have a solution which has multiple output projects (a website, and admin tool,
I have a solution which has many projects inside it. I build the solution
My ASP.NET MVC 2 application uses Entity Framework 4.0 for the data model. Following

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.