0

I am trying to develop a web application using MVC3 architecture.

I have DAL library for all database related operations and my web application is a separate application.

Now, if I update my .edmx file by drag and drop in DAL library, the app.config file of that library gets updated.

And this is fine when I am developing, but while deploying, I do not want my application to use connectionstring from app.config file, but instead from web.config file from my web application.

Can anybody give me an idea how to achieve this?

Thank you.

1 Answer 1

1

You can pass your connection string to the DataContext.

e.g.

using (var context = new DataContext(Setting.MyConnectionString))
{
   var query = context.MyTable.Where(s => s.Id == 1);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.