Using Lambda Container with Web API

If you are using owin, please look here in stead: OWIN Integration
The web api integration package enables dependencies to be injected by Lambda Container.
This means that any dependencies specified in an API Controller's ctor arguments will be resolved through the Lambda Container.

Configuration example in C#
var httpConfiguration = new HttpConfiguration();
LambdaContainerBootstrapper
    .Create()
    .ConfigureForWebApi()
    .Run()
    .EnableAsWebApiDependencyResolver(httpConfiguration);
            
httpConfiguration.MapHttpAttributeRoutes();

//The rest of the startup class
.....
...
.


The first extension method .ConfigureForWebApi() is called to change the directory hive to the standard "\bin" folder used for application assemblies in Web API.

The Lambda Container will be fully operational after the bootstrapper has been executed but it is not until the second extension is called .EnableAsWebApiDependencyResolver(httpConfiguration) that Web API will begin to use it as it's dependency resolver.

Last edited Apr 22, 2016 at 7:16 AM by Remboel, version 6