0

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 ?

Steven H
  • 189
  • 6

1 Answers1

0

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.

Paul Knopf
  • 9,568
  • 23
  • 77
  • 142
  • I am marking this as the accepted answer as this certainly lead me into the right direction of stepping back and going back to the documentation rather than piecing together random examples which lead me to the solution. – Steven H Jun 13 '13 at 10:33
  • 1
    @StevenH Could you perhaps elaborate on the found solution? Thanks. – faester May 19 '14 at 20:44