2

I've got a webforms app that I'd like to use dependency injection on. I realize that I can't use DI to construct the each Page because webforms doesn't have the proper hooks like aspnet MVC does.

Nate Kohari suggests on the ninject mailing list that you could create a base page that would handle dependency resolution via property injection, which certainly seems like it would work.

But my webforms app implements the Model-View-Presenter pattern and I want to know why I couldn't just use my container to resolve my Presenter in the view's constructor since my presenter should have all the dependencies that I would need to resolve? Is there any dependency that I would want/need to resolve that sits directly on the view?

viggity
  • 15,039
  • 7
  • 88
  • 96

1 Answers1

2

Looking at the link, I see no functional difference between what he/she is suggesting and the alternative you mention in your last paragraph. Having the kernel property in the base page seems overengineered, since you are just going to be accessing a static kernel at some point anyway.

Phil Sandler
  • 27,544
  • 21
  • 86
  • 147