Create custom application configuration settings


1. Overview

This sample shows how to create custom application configuration settings.

2. Getting started

The following prerequisites must be installed on your computer:

  • Visual Studio 2015, or higher
  • Microsoft .NET Framework 4.6.1
  • A deployed instance of Dundas BI version 6 or higher.

If the instance is less than version 6, the project must be switched to use .NET 4.5.2.

2.1. Downloading sample solution

To download the custom application configuration sample solution, click here.

2.2. Extracting sample to SDK folder

This sample is designed to automatically publish the extension to the instance. First, you must extract to the SDK folder within the instance:

  1. Find the SDK folder for your instance. It is located at [instance root]\sdk.
  2. Extract to the SDK folder.
  3. You should see the following result:

    Samples added to SDK folder
    Samples added to SDK folder

    With the following structure:

    • [instance root]
      • sdk
        • Samples
          • AppConfigSample

If the sample is not in this specific folder, it will not work correctly.

2.3. Opening solution

Find and open the solution located at:

[instance root]\sdk\samples\AppConfigSample\AppConfigSample.sln

3. The project

The project is a class library.

  • AppConfigSamplePackageInfo.cs - This class contains the package information about the extension package, and the methods for registering the new application setting.
  • PublishExtension.targets - Used for auto publishing the extension after the build succeeds.

3.1. ExtensionPackageInfo class

In order for the extension to be read by Dundas BI, it needs to contain a class that extends the ExtensionPackageInfo class. This class contains the extension package information.

using Dundas.BI;
using Dundas.BI.Configuration;
using Dundas.BI.Extensibility;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace MyCompany.Sample.AppConfigSample
	/// <summary>
	/// This class contains the package information about the extension package.
	/// </summary>
	public class AppConfigSamplePackageInfo : ExtensionPackageInfo

		/// <summary>
		/// Gets the name of the extension package author.
		/// </summary>
		public override string Author
			get { return "Dundas Data Visualization Sample Author"; }

		/// <summary>
		/// Gets the copyright text associated with the extension package.
		/// </summary>
		public override string Copyright
			get { return "Dundas Data Visualization, Inc."; }

		/// <summary>
		/// Gets the localized display name of the extension package.
		/// </summary>
		public override string DisplayName
			get {   return "App Config Sample Package";  }

		/// <summary>
		/// Gets the unique identifier of the extension package.
		/// </summary>
		public override Guid Id
			get { return new Guid("7e5eef83-f270-4f60-91dc-8d809f4f2b19"); }

		/// <summary>
		/// Gets the name of the extension package.
		/// </summary>
		public override string Name
			get { return "AppConfig Sample Package"; }

		/// <summary>
		/// Gets the version of the extension package.
		/// </summary>
		public override Version Version
			get { return new Version(0, 0, 1); }


In order to add an application setting to Dundas BI overload the OnLoaded method of the ExtensionPackageInfo class. Next, get the application configuration service (IAppConfigService) from the engine. Finally, create an ApplicationSettingProperties object and then use the Application Configuration Service to register the setting.

In the sample below a hello world application setting is added to Dundas BI:

private void RegisterSettings()
	IAppConfigService appConfigService =

	AppSettingProperties appSettingsProperties =
		new AppSettingProperties(
	appSettingsProperties.CategoryName = "Hello World Category";
	appSettingsProperties.Description = "Hello World Property";

	appSettingsProperties.DefaultValue = string.Empty;

/// <summary>
/// Called after the extension package is loaded during engine startup.
/// </summary>
public override void OnLoaded()

3.2. Validating an application setting

Each application setting can be validated by setting the ValidationRule property. This property takes AppSettingValidationRule. In the sample below a StringValidationRule is used to ensure that the property is set with hello followed by a space and then some text.

int maxLength = 1000;
bool isEmptyStringValid = true;
Regex regularExpressionToMatch = new Regex("Hello[\\s](.*?)", RegexOptions.IgnoreCase);

AppSettingValidationRule appSettingValidationRule =
    new StringValidationRule(maxLength, regularExpressionToMatch, isEmptyStringValid);

appSettingsProperties.ValidationRule = appSettingValidationRule;

3.3. Publish extension targets

This sample has a mechanism to automatically publish the extension. This mechanism is the PublishExtension.targets file, which overrides the AfterBuild target. This will create the following file after successfully compiling the solution:

[instance root]\www\BIWebsite\App_Data\Extensions\AppConfigSample\bin\AppConfigSample.dll

It will then touch the web.config to force the web application to reset.

4. See also

Dundas Data Visualization, Inc.
500-250 Ferrand Drive
Toronto, ON, Canada
M3C 3G8

North America: 1.800.463.1492
International: 1.416.467.5100

Dundas Support Hours: 7am-6pm, ET, Mon-Fri