The Composite Web Application Block in the Composite Web Client Library Bundle gets new MasterPage, Page and UserControl Base Classes to help hide the dependency injection changes in the new version done via ObjectBuilder.
As mentioned before, one of the breaking changes in the Composite Web Application Block from Web Client Software Factory v1.0 to v2.0 is the way dependency injection is done in a MasterPage, Page, UserControl, WebService, etc.
The new dependency injection method is as follows:
WebClientApplication.BuildItemWithCurrentContext(this);
There is a new namespace in Microsoft.Practices.CompositeWeb, called Microsoft.Practices.CompositeWeb.Web.UI, that contains new base classes for MasterPage, Page and UserControls that override OnInit in MasterPage and UserControl and OnPreInit in the Page class and do the following:
public class Page : Page
{
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
WebClientApplication.BuildItemWithCurrentContext(this);
}
}
Now when you derive your classes from either the MasterPage, Page or UserControl in Microsoft.Practices.CompositeWeb.Web.UI, the base class hides the call for dependency injection. Using the base classes are optional.