Monday, June 12, 2006

Dynamic Properties .NET

What is Dynamic Proprty?
Dynamic properties allow you to configure your application so that some or all of its property values are stored in an external configuration file rather than in the application's compiled code. By providing administrators with the means to update property values that may need to change over time, this can reduce the total cost of maintaining an application after the application has been deployed.
For example, suppose you are building an application that uses a test database during the development process, and you need to switch it to a production database when you deploy it.

How to read from configuration file in C#?
this.sqlConnection1.ConnectionString = ((string)( System.Configuration.ConfigurationSettings.AppSettings.GetValues("SqlConnection1.ConnectionString"))));

How to add in Config file?
In the configuration file, the value for this property would be stored via XML, using the key indicated in the form's code:

Where I can find more information?


Post a Comment

<< Home