0

I created windows form application having 3 layers as UI, BLL and DLL. I used DB first methodology. It was created a data model using below steps.

ADO.Net entity data model --> EF designer from database --> Then I gave the DB connection.

With above steps it was created data model as edmx file. DAL has app.config file and UI layer also has app.config. It was generated connection string automatically in DAL app.config. Then I copy and paste generated connection string part to UI app.config file. Actually solution is working fine. But I think, define one connection string in 2 places (DAL app.config and UI app.config) is not a best practice. Please guide me to do this (maintain one connection string in one place) in proper way.

How to maintain the connection string in one place?

weeraa
  • 1,123
  • 8
  • 23
  • 40
  • 1
    The Connection String is only needed in your default projects config file. (I mean StartUp Project) – Ahmet Remzi EKMEKCI Jun 16 '17 at 12:06
  • No. If I remove connection string from DAL app.config file, the project is not working. It means data not saving. This is the error message after removing connection string from app.config. "No connection string named 'DataEntities' could be found in the application config file." – weeraa Jun 16 '17 at 15:52

0 Answers0