How change application setting in class library project programmatically?

  • Thread starter Thread starter Ronald S. Cook
  • Start date Start date
R

Ronald S. Cook

In my solution, I have a client (Windows app) and a class library. The
class library project has a connection string setting that I would like to
be able to change (from the client project ultimately).

However, when I try to change the setting programmatically, it says it can't
because it's read-only. This is not the case when I want to change a
setting in the client project.

Any idea what's up? If it matters, the class library has a .dbml file since
we're using LINQ to SQL (but I don't think that has an impact).

Basically, I want the client to be able to switch which database it's
pointing to.

Thanks for any input,
Ron
 
In my solution, I have a client (Windows app) and a class library.  The
class library project has a connection string setting that I would like to
be able to change (from the client project ultimately).

However, when I try to change the setting programmatically, it says it can't
because it's read-only.  This is not the case when I want to change a
setting in the client project.

Any idea what's up?  If it matters, the class library has a .dbml file since
we're using LINQ to SQL (but I don't think that has an impact).

Basically, I want the client to be able to switch which database it's
pointing to.

Thanks for any input,
Ron

Hi,

You can declare the connectionstring in the config of the win app and
you can access it from the dll.
 
In my solution, I have a client (Windows app) and a class library.  The
class library project has a connection string setting that I would like to
be able to change (from the client project ultimately).

However, when I try to change the setting programmatically, it says it can't
because it's read-only.  This is not the case when I want to change a
setting in the client project.

Any idea what's up?  If it matters, the class library has a .dbml file since
we're using LINQ to SQL (but I don't think that has an impact).

Basically, I want the client to be able to switch which database it's
pointing to.

Thanks for any input,
Ron

Additionally, you could create a "Init" method for the library where
you can pass the parameters that you need.
 
Back
Top