Skip to content
  1. We help small teams achieve big things.
  2. Our Technical Fellow just became a Microsoft MVP!
  3. We run the Azure Weekly newsletter.
  4. We just won 2 awards.
  5. We just published Programming C# 8.0 book.
  6. We run the Power BI Weekly newsletter.
  7. Our NDC London 2020 talk is now available online!
  8. We are school STEM ambassadors.
Mike Larah By Mike Larah Software Engineer II

As I was setting up the framework for my apprenticeship portal MVC 4 web application, I used part of endjin's core composition framework for the dependency injection, which utilises Castle Windsor.

(Here is a link to some useful videos on dependency injection and Castle Windsor that helped me to understand why they are used).

Part of the framework uses a class called WindsorContainerBootstrapper which calls a GetInstallers method which looks through all referenced assemblies and finds and returns a list of the Windsor Installers that are contained within them.

This was designed for console applications though. To make this work, I made a change so that it uses the HttpRuntime.BinDirectory method to correctly locate the bin folder where the assemblies are stored in a web application.

This extra class could not be added to Endjin.Core.Composition though as HttpRuntime is dependent on System.Web, and Endjin.Core.Composition uses the .NET 4 Client Profile which does not support this.

So I added a new WindsorContainerWebBootstrapper class to the project and called it in the dependency injection configuration to initialise a new Windsor Container.

This means I can now resolve my types dynamically.

(As a side note, we now have a GitHub Gist plugin installed for the blog so all the pasted code looks pretty)

@MikeLarah

Mike Larah

Software Engineer II

Mike Larah

Mike is a Software Engineer at endjin with almost 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.