FSou1
FSou1

Reputation: 1941

Ninject and controllers in dll

I have ASP .NET MVC 3 application and Class Library project, where i'd like to move all my controllers and then bind them using Ninject (controllers should be in .dll file). Is it possible to bind controllers from assembly (.dll) using Ninject?

Upvotes: 2

Views: 233

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038800

Yes, it is possible. The Ninject configuration is always performed in the ASP.NET MVC application which references all dependencies. So if your controllers are defined in a separate class library this assembly will obviously be referenced in your ASP.NET MVC application and you will be able to define your Ninject modules inside it.

A dependency injection container is always configured in the outermost layer of an onion architecture which for an ASP.NET MVC application is the web project itself because this layer has knowledge of the inner layers.

Upvotes: 3

Related Questions