New Web Client Software Factory Drop Puts a Kabash on Dependency Injection into Views

New Web Client Software Factory Drop Puts a Kabash on Dependency Injection into Views

by David Hayden ( Microsoft MVP C# ), Filed: Web Client Software Factory

 

Sigh... My favorite feature in the Web Client Software Factory appears to be D E A D, dead, in version 2. I really liked that the Composite Web Application Block via ObjectBuilder automatically injected dependencies into my views by intercepting the page in the application lifecycle before the page started its page life cycle. Hence the presenter class ( if using the View-Presenter Pattern ) was automatically injected into the view with just the simple use of a [CreateNew] Attribute:

 

[CreateNew]
public MyPresenter Presenter
{
    set
    {
        this._presenter = value;
        this._presenter.View = this;
    }
}

 

Unfortunately, it appears this feature was a bit tough to get to work with usercontrols, master pages, web services, etc. so now you have to use a service locator approach in addition to the attribute.

 

protected override void OnInit(EventArgs e)
{
    WebClientApplication.BuildItemWithCurrentContext(this);
    base.OnInit(e);
}

 

and then it will look through whatever this is ( in this case a view ) and fill in any dependencies.

My first reaction is that I can do that today without the Web Client Software Factory using Windsor. And, Windsor is much more feature rich than the container used today in the Web Client Software Factory. Feels like a step back for me, but maybe there is a plus to all of this and I am not seeing it yet.

 

Source: David Hayden ( Microsoft MVP C# )

Filed: Web Client Software Factory

 

posted on Wednesday, July 11, 2007 8:43 PM

Main

David Hayden Google +

David Hayden Twitter

Health & Fitness

JavaScript Patterns Book Review

HTML 5 and CSS3 - Develop with Tomorrow's Standards Today

Professional ASP.NET Design Patterns Book Review

Beginning Mac Programming Book Review

C# in Depth Book Review

ASP.NET MVC

Orchard CMS

Categories