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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论