Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #15 from ccellar/PR/Registration
Browse files Browse the repository at this point in the history
Added container registration for Func<IRouteCache>
  • Loading branch information
thecodejunkie committed Jun 4, 2014
2 parents 1f2b79b + 8c595aa commit 02bfa96
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Nancy.BootStrappers.Windsor/WindsorNancyBootstrapper.cs
Expand Up @@ -13,6 +13,7 @@ namespace Nancy.Bootstrappers.Windsor
using Castle.Windsor;
using Diagnostics;
using Bootstrapper;
using Routing;

/// <summary>
/// Nancy bootstrapper for the Windsor container.
Expand Down Expand Up @@ -169,6 +170,11 @@ protected override void RegisterModules(IWindsorContainer container, IEnumerable
protected override void RegisterBootstrapperTypes(IWindsorContainer applicationContainer)
{
applicationContainer.Register(Component.For<INancyModuleCatalog>().Instance(this));

// DefaultRouteCacheProvider doesn't have a parameterless constructor.
// It has a Func<IRouteCache> parameter, which Castle Windsor doesn't know how to handle
var routeCacheFactory = new Func<IRouteCache>(applicationContainer.Resolve<IRouteCache>);
applicationContainer.Register(Component.For<Func<IRouteCache>>().Instance(routeCacheFactory));
}

/// <summary>
Expand Down

0 comments on commit 02bfa96

Please sign in to comment.