1

I'm working on a .Net 4.5 web application project which has multiple DAL projects to interact with several back-end systems. Our DAL projects maintain connection strings in the project settings. We do not manage them through the web.config. We recently added a new DAL using EF5. It appears that EF 5 required a connection string reside in the web.config in addition to the DAL project's app.config. We would prefer this connection string reside in the DAL project alone for consistency.

Any suggestions on how to accomplish this?

My issue is similar to the following post: Entity Framework - layered design - Where to put connectionstring?

Thanks for any feedback.

Community
  • 1
  • 1
RollTide
  • 302
  • 1
  • 4
  • 8

1 Answers1

0

I think the best way. You have to use EntityConnectionStringBuilder, so you can set the database names and settings in the the app.config but in your code you build the connection string.

Visit http://msdn.microsoft.com/en-us/library/system.data.entityclient.entityconnectionstringbuilder.aspx

See also DBConnectionStringBuilder :

http://msdn.microsoft.com/en-us/library/system.data.common.dbconnectionstringbuilder.aspx

Bassam Alugili
  • 16,345
  • 7
  • 52
  • 70