scampercat

scampercat

  • NA
  • 189
  • 0

C# linq accessing the app.config file

Jun 22 2013 4:32 PM
I am having a linq to sql problem with a C# 2010 windows form application when it is changed to a dll and accessed by other applications. The purpose of the calling the code as a dll is for performance reasons and to share the code accross multiple applications.

When the application is on its own, it runs fine.

Basically when the linq to sql was dragged to the desktop, a default linq to sql connection was setup by the .net framework. However I changed the *.designer.cs  to use the system.configuration namespace,
added a reference to the system.configuration namespace, and changed the default linq to sql connection to use the database connection obttained in app.config file. I also removed any refernces to the default database connections in the the 'properties or 'settings' section for each project file folder.

Now the problem is the default setting values to the database are reset by the .net framework. Thwe values in the app.config file are no longer being used.

Can you show me code, point me to a reference, and/or tell how I can make this application is the connection string values in the app.config file again?