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 1104487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:29:28+00:00 2026-05-17T01:29:28+00:00

My ASP.NET MVC 2 application uses Entity Framework 4.0 for the data model. Following

  • 0

My ASP.NET MVC 2 application uses Entity Framework 4.0 for the data model. Following the instructions on http://blogs.msdn.com/b/aspnetue/archive/2010/09/17/second_2d00_post.aspx I put the .edmx in its own assembly so my solution has two projects:

MyApp.Core (ASP.NET MVC 2 Web Application Project, references MyApp.DataLayer)
 Models/
 Controllers/
 Views/
 Web.config

MyApp.DataLayer (Class Library Project)
 Entities.edmx
 App.Config (<-- generated by edmx when I update model from DB)

When I regenerate Entities.edmx, it creates the App.Config file under MyApp.DataLayer with connection strings to the database. The problem is that when I deploy the solution, the Web.config is the only config also deployed, so I have to manually add these connection strings to it otherwise I get an exception at runtime because they cannot be found.

I’d like to not the same connection string defined in both Web.config and App.Config. How should I organize my projects/config files such that the connection string to the db are found in only one place? Is this possible?

  • 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-17T01:29:29+00:00Added an answer on May 17, 2026 at 1:29 am

    You can either embed the autogenerated app.config in your Model project and reference the connection string when you create your DataContext using GetEmbeddedResource…or (the more normal approach) copy the connection strings manually from the auto-generated app.config to your web.config.

    If you want to be really ingenuitive, create a simple T4 template that copies the app.config connection strings in your web.config when you generate the EDMX model.

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

Sidebar

Ask A Question

Stats

  • Questions 540k
  • Answers 540k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It looks like the loading graphic is being shown onLoad,… May 17, 2026 at 2:42 am
  • Editorial Team
    Editorial Team added an answer Just added a new release to the project and used… May 17, 2026 at 2:42 am
  • Editorial Team
    Editorial Team added an answer With the XML document open, look in the Property Grid… May 17, 2026 at 2:42 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have an asp.net mvc application, which uses the default user database. It all
I have a simple ASP.NET MVC web application that uses NHibernate with FluentNHibernate's auto
I have an ASP.NET MVC application which is pretty simple so far, but I
I'm using in memory sessions in my ASP.NET MVC application which means that I
We have an ASP.NET application that's partly in MVC (the rest of it being
I've been working through a fantastic book (Pro ASP.net MVC 2 Framework, Steven Sanderson)
My ASP.NET MVC 2 application runs under built-in local NETWORK SERVICE account. I want
I have built a MVC website on IIS6. I used the built-in ASP.NET Security
I am trying to centralise the data access within my small company. The data
I have a webapplication which uses an external webservice to send files and messages.

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.