Skip to content

Autofac Integration

Colin Scott edited this page Aug 24, 2014 · 1 revision

LightBlue provides optional support for the Autofac IoC container. This may be installed with:

Import-Package LightBlue.Autofac -pre

Autofac will provide the appropriate implementations of the LightBlue APIs based on whether the role is being run in LightBlue, the emulator or actual Azure. Configuration of Autofac is performed by calling the RegisterLightBlueModules() extension method on an Autofac ContainerBuilder instance.

    var containerBuilder = new ContainerBuilder();
    containerBuilder.RegisterLightBlueModules();

This will register with the container the core abstractions such as IAzureEnvironmentSource from the Environment API and IAzureSettings from the Settings API. These can be resolved directly or (preferably) be dependencies of other types resolved via Autofac. Also registered will be factory methods from the Storage API that provide the points of entry into the LightBlue storage abstractions.

Clone this wiki locally