Question

I am investigating integrating N2CMS into an existing website.

The problem that I am getting is that the IOC engine that N2CMS uses (tinyIoC) doesnt know about any of the dependencies of my Controllers. So when any of my Controllers are created I get an error similar to :

TinyIoCResolutionException: Unable to resolve type: NLog.Logger (where NLogger is a dependency of a Controller that is being instantiated)

My website uses Ninject; I have worked out that N2CMS will use a Service Locator (an implementation of a N2.Engine.IServiceContainer) to push dependencies around.

Has anybody built anything similar ?

Was it helpful?

Solution

I suspect you are using Dynamico? Out of the box, it resolves the controllers from the N2CMS container.

My first step in setting up an N2CMS project is to modify the controller factory to return the controller from my own container. N2 services are never injected into my controllers or business logic layer.

Use N2.Context to access everything you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top