Table of Contents

Interface IConfigurator<T>

Namespace
Tlabs.Config
Assembly
Tlabs.Core.dll

Base interface of a dynamically loaded configurator.

public interface IConfigurator<T>

Type Parameters

T

Type of the target builder to add configuration

Extension Methods

Remarks

Objects of classes implementing this interface can be loaded from configuration sections like:

  • webHosting.configurator
  • applicationMiddleware
  • applicationServices
  • logging.configurator

by the fully qualified class name specified by the type property.

The object loader supports the default constructor or a constructor taking a single Dictionary<string, string> as parameter. Once an instance of this configurator object has been created the method AddTo(T target, IConfiguration cfg) is called.

  • target gives a target builder of type T to add the configuration.
  • cfg represents the current configuration section

An example configuration woul look like this:

"Persistence.SqLiteDbProvider": {
	"type": "Tlabs.Data.Store.SqliteConfigurator, App.SqLiteDataStore",
	"config": {
		"connection": "DataSource=rsc/store/__app.sqlite;Foreign Keys=True", //;Default Timeout=35;Pooling=True"
		"migrationAssembly": "App.dataStore"
	}
},

NOTE: The properties of the config object would be available with the Dictionary<string, string> parameter passed to the ctor...

Methods

AddTo(T, IConfiguration)

Method called to add a specific configuration to a target.

void AddTo(T target, IConfiguration cfg)

Parameters

target T
cfg IConfiguration