Entity Framework Model - Connection String Issues (ASP.NET)

I am trying to use LINQ, and having a problem deploying.
.net 3.5

On my local box, I create a ADo.NET Entity Data Model, and it prompts me for the connection string (in this example we will call it A). It populates all the table structure and creates A.edmx in my app_code folder.

However the connection string is different on the production server, so i need to specify that it should now use that string (call it B) on production.

How do i do this?

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

HADDADD3Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NavneetSoftware EngineerCommented:
Hi!

You need to have some static String in your Application
Which will be set on Application Load,
So when Application Starts You let User Select the  connection OR Read the String from Config file

Hence you instantiate your context with the provided connectionString
context have constructor where you can set the ConnectionString

Thanks!
0
HADDADD3Author Commented:
That makes no sense? Application set by the user? It is a ASP.NET WEB APP why would the user specify a connection string?
0
NavneetSoftware EngineerCommented:
Hi!
I didn't mean that user set the connectionString. :)
Ok Let's put it in better way.

1. You have an Application and Say you want to change the Connection.
2. Either you set the connection string in config file or you get the ConnectionString from WebService.
3. Now when you Load the application and Create Entity DBContext you pass this ConnectionString to DBcontext.

new DbContext(connectionString/Connection)

Now when I say User Select the Connection : When your application Loads You have Dropdown with Option
Development. Test , Production
So user select item from Dropdown and as per the selection you pick the connectionString from config file.



Thanks!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.