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

In the last post I introduced v2.0 of our open source, composition framework. In this post, I'm going to cover a quick example of how to get started with the basics of the endjin composition framework.

Firstly, we define an interface for some type

Discover your Power BI Maturity Score by taking our FREE 5 minute quiz.

Then, we create a concrete type for our interface

Now we can use one the composition framework's convention based installers. For instance we could use the namespace installer, to install all types in a given namespace into the container.

The namespace installer will register types against their Default interface - where the default interface is the interface that follows the naming convention I + [my specific name] + [service name] (e.g. the default interface for class FooBarService : IFooService, IFooBarService is IFooBarService)

Most of the convention-based installers will install the concrete type into the container as Transient by default, but we can explicit specify the lifestyle using [Singleton] and [Transient] attributes.

See the Installers page on the GitHub wiki for a complete list of all the installers included in the framework, and explanations of how they work.

Next step is to initialize the container within our application's start-up code. This is done using the Bootstrapper appropriate for whichever framework we are using, which will locate the installers in our assemblies and install the types they find into the container.

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!

WP8

WinRT

.NET 4.0/4.5

You can now use the static ApplicationServiceLocator.Container for resolving your root types.

In the next post, I'll go over how to use the ContentFactory for registering content with custom names.

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