This project is read-only.

The ConfigurationLoader Class

The easiest way to load Drill configuration from .NET config files is the Drill.Configuration.ConfigurationLoader class. This static utility class exposes the following methods:
  • LoadAllDependencyResolverConfigs() - Loads all dependency resolver configuration data from the default .NET configuration file. This method returns a collection of dependency resolver configuration data.
  • LoadAllDependencyResolverConfigs(string filename) - Loads all dependency resolver configuration data from the specified .NET configuration file. This method allows the caller to specify absolute path to a specific .NET configuration file from which to read the dependency resolver configuration data. This is useful when you have split up your configuration into multiple file or use a custom location for configuration. This method returns a collection of dependency resolver configuration data.
  • LoadDependencyResolverConfig(string name) - Loads the specified dependency resolver configuration data from the default .NET configuration file. The name of a configured dependency resolver is required. This method returns configuration data for the specified dependency resolver only.
  • LoadDependencyResolverConfig(string name, string filename) - Loads the specified dependency resolver configuration data from the specified .NET configuration file. This method allows the caller to specify absolute path to a specific .NET configuration file from which to read the dependency resolver configuration data. This is useful when you have split up your configuration into multiple file or use a custom location for configuration. This method returns configuration data for the specified dependency resolver only.

The ConfigurationLoader class handles the work with the DependencyResolversConfigurationSection class and returns the data using the Drill configuration model.

How to create a dependency resolver using configuration from the .NET config file

The example code snippet below shows how to use the ConfigurationLoader to load the configuration for a specific dependency resolver ("MyResolver") from the default .NET config file, feeding the returned configuration object graph to the Create method of the DependencyResolverManager class.

	IDependencyResolverConfiguration config =
		ConfigurationLoader.LoadDependencyResolverConfig("MyResolver");

	IDependencyResolver dependencyResolver = 
		DependencyResolverManager.Create(config);



Last edited Nov 21, 2012 at 12:52 AM by wreynolds, version 1

Comments

No comments yet.