With ASP.NET MVC it is pretty easy to integrate an IoC container to create the controllers.
Is the same thing also possible with webforms to create the pages and controls and pass them any dependencies? If yes, where do I have to plug it in?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not directly, as Web Forms does not allow any code to take control of Page and Control instantiation. So something like a Page Factory is not feasible, and you can’t do constructor injection.
But there are work arounds/hacks that can buy you setter injection as others have mentioned.