I have an ASP.NET page that implements my view and creates a presenter on a constuctor page. As a starting point, I used a post provided by Phil Haack , and I will just give examples from this post to illustrate the issue.
public partial class _Default : System.Web.UI.Page, IPostEditView { PostEditController controller; public _Default() { this.controller = new PostEditController(this, new BlogDataService()); } }
What is the best approach to inject an instance of BlogDataService? The examples I found use the properties of the Page class for dependencies marked with an attribute that the injection infrastructure allows.
However, I prefer to use the constructor approach for testing purposes.
Does anyone have an input, or possibly links to good implementations above. I would prefer Ninject, but StructureMap or Windsor would be nice as long as it is fluent.
Thanks for any feedback.
source share