Skip to content
Mike Evans-Larah By Mike Evans-Larah Software Engineer III
Introducing endjin composition framework 2.0 : Part 1

We've just pushed out version 2.0 of our open-source, component composition framework. This is the framework we use internally day-in, day-out for our dependency injection. The previous version had a dependency on Castle Windsor, but in this new version we have implemented our own container.

There are a few reasons we decided to take this step. Mainly, we were developing some early Windows Phone 8 and Windows 8 applications last year, like our cross-platform charting controls and Milliman's Azure Compute Dashboard, and we couldn't live without DI. At the time, none of the existing container frameworks supported all the main Microsoft platforms that we were working with, so we had to "roll our own". I did attempt to build a Windows 8 Azure Dashboard app (see pic) without DI to begin with, but the barrier to maintainability meant when it got large enough I ended up pretty much going back to the start and reimplementing it using our new framework.

endjin azure dashboard image

Other containers are also really expensive for a 'miss' scenario (i.e. trying to resolve a component that isn't registered in the container), because they use exceptions to implement this. We wanted to be really efficient for failing to find a match so we could implement an inexpensive "fallback mechanism" (e.g. looking in the container for handlers for specific content types, falling back to more general versions, if they were not found).

The other reason was, as much as we love Castle Windsor, it does a lot (much like the Spring Framework in the Java ecosystem). It suffers from a problem that many OSS projects do - it's based on contributions from the community but rarely do people rationalise and prune the feature set. So with our container, we've stripped it back and included only the features we require. This means that there's lots it doesn't do, but in this series of blog posts, we're going to cover many of the main usage scenarios.

Whatever the framework, component composition works the same way: you have contracts and concrete implementations and you need to map one against the other. The Endjin Composition Framework helps you work smarter, not harder by making component composition simple.

Programming C# 12 Book, by Ian Griffiths, published by O'Reilly Media, is now available to buy.

You can install the packages via NuGet or the source code is available up on the endjin GitHub page. There are packages for use with .NET 4.0, .NET 4.5, WinRT and Windows Phone 8 frameworks. Additionally there is an Endjin.Core.Composition.Web package with extensions for use in ASP.NET MVC 4 / WebAPI applications.

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!

There are samples in the GitHub repo for how to use component composition for each of the supported frameworks, and in the next post I'll go over how to get set up.

@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.