Maxim V. Pavlov
Maxim V. Pavlov

Reputation: 10509

IoC container initialization in MVC3 application

If an MVC3 application (an example project name - SuperApp.Web) is relying on a business logic that resides in a separate assembly (SuperApp.Core), is IoC container initialization still takes place in web site project's code?

I understand that web site is actually an application, and the initialization control is passed to it, but it would be more logical if a dependencies for a .Core project would be getting resolved in it, with it's own IoC container library reference.

I am using Ninject in particular, and so far I've seen all initialization done with the help of WebActivator in Applications "Start" method. Is it possible for a site project to be IoC free, and let the BL dll figure out what it's going to be working with?

Upvotes: 0

Views: 205

Answers (1)

undefined
undefined

Reputation: 34248

One of the things you can look into for this is to create a ninject module in your Core project with the bindings relating directly to core. However you still need to register this module in your running application, so no you cant have your site project running without managing the DI container. This is because you need to plug your DI in at the construction of your controllers

Upvotes: 1

Related Questions