开发者

Using ninject (DI) to instantiate a presenter with webforms and MVP

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 ninje开发者_如何学编程ct 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜