I want to inject a presenter into my webform class. While doing so I would like the injected presenter to contain a reference to the view it is being injected into. Inject a class with a reference to the class it is injected into. Is it possible to do this with Ninject? When injecting into a webforms class, is the injection performed before the constructor is executed? Should I rather just inject the presenter and use the constructor to pass the view?

有帮助吗?

解决方案

For webforms this is not possible because the form is not created by ninject. You have to pass it manually to the presenter.

I think the solution is to use MVC there you have support for your problem form the framework. Webforms and MVC can be mixed. You can create new pages with MVC and still use the old webform ones. Whenyou have to change a webforms page then you better refactor it to MVC befor the change.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top