Skip to content
Mike Evans-Larah By Mike Evans-Larah Software Engineer III
Introducing endjin composition framework 2.0 : Part 4 - ASP.NET MVC/WebAPI

To use endjin composition framework with an ASP.NET MVC 4/WebAPI application, firstly pull in the Endjin.Core.Composition.Web package from NuGet.

Following the steps from the previous posts, you can set up your interfaces, concrete types and installers. No further initialization is required though - the package includes extensions for configuring and initializing the container, and also an installer for your MVC and WebAPI controllers.

Power BI Weekly is a collation of the week's top news and articles from the Power BI ecosystem, all presented to you in one, handy newsletter!

The installer looks for all MVC and WebAPI controllers in the solution and registers them into the container. The configuration initializes the container and sets it to be used by the dependency resolver for MVC and WebAPI.

So long as the composition web package is referenced, this configuration is all done automatically on application startup using WebActivator.

This now allows you to use interfaces as your controllers' constructor parameters.

Azure Weekly is a summary of the week's top Microsoft Azure news from AI to Availability Zones. Keep on top of all the latest Azure developments!

As long as concrete types for these interfaces have been registered in the container, the dependencies will be resolved whenever a request is made against a controller.

In the next post, I will be looking at what happens if you haven't registered all dependencies, and how to debug the container.

@MikeLarah

Mike Evans-Larah

Software Engineer III

Mike Evans-Larah

Mike is a Software Engineer at endjin with over a decade of experience in solving business problems with technology. He has worked on a wide range of projects for clients across industries such as financial services, recruitment, and retail, with a strong focus on Azure technologies.