Configuration Files

One of the new features in SimpleLookups 1.5 and above is the ability to initialize your database connection strings in the web.config file. The schema file for the config file can be found here:

v1.5.x
v1.6.x
v2.0.x

To use this feature, follow these steps:

1. Add the following to the <configSections> element, inside of the main <configuration> element, making sure that the version number matches the version you have:

2. Add any connection strings as you would normally. See MSDN for more information about this.

3. Add the <simpleLookups> element inside of the main <configuration> element. Like so:

The connectionStringName attribute is the name of a connection string that has been added. Note: If more than one connection string is defined, one of them must have isDefault=”true”. As of v1.6, you can also specify the column suffixes that are used, and whether or not the table name is prefixed to the columns in the table. Additionally, as of v2.0, you can set up caching by specifying those settings. The Cache Refresh Period is in seconds. Here’s that in action:

That’s all there is to it.