How do I configure Ninject so it injects an instance in a view model?

PS. It is an abstracted service to help with validation, so I am not trying to burden the model with too much responsibilities.

1 Answer 1


Refer to this SO question - https://stackoverflow.com/questions/8176654/di-ninject-working-for-controllers-but-not-view-model, which points to this link - http://bradwilson.typepad.com/blog/2010/10/service-location-pt5-idependencyresolver.html.

I also had the same issue. For that I extended my NinjectControllerFactory class to provide me with an instance of the required dependency. I blogged about this here - http://blog.thekfactor.info/posts/dependency-injection/.

I may have to look in to the link from the SO post too and see if that's a better alternative.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.