Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

ISupportsWebDependencyInjection Interface

"Contract"-interface of the Web-DI infrastructure.

For a list of all members of this type, see ISupportsWebDependencyInjection Members .

[Visual Basic]
Public Interface ISupportsWebDependencyInjection
[C#]
public interface ISupportsWebDependencyInjection

Types that implement ISupportsWebDependencyInjection

Type Description
AbstractWizard Convinience implementation of the wizard-like page controller.
DataBindingPanel Any WebControl placed on a DataBindingPanel may be bound to a model by adding an attribute "BindingTarget"
Panel This panel provides the same features as Panel, but provides additional means with regards to Spring.
MasterPage Spring.NET Master Page implementation for ASP.NET 2.0
Page Represents an .aspx file, also known as a Web Forms page, requested from a server that hosts an ASP.NET Web application.
UserControl Extends standard .Net user control by adding data binding and localization functionality.

Remarks

This interface supports Spring's DI infrastructure and normally doesn't need to be implemented

Any Page, Control or ControlCollection implementing this interface guarantees to call InjectDependenciesRecursive on any control being added before it is actually added to the child-collection.

Example

The following example shows, how to make a Control support the DI-infrastructure:

class MyControl : Control, ISupportsWebDependencyInjection
{
    private IApplicationContext _defaultApplicationContext;

    public IApplicationContext DefaultApplicationContext
    {
        get { return _defaultApplicationContext; }
        set { _defaultApplicationContext = value; }
    }

    override protected AddedControl( Control control, int index )
    {
        WebUtils.InjectDependenciesRecursive( _defaultApplicationContext, control );
        base.AddedControl( control, index );
    }
}

The following example shows, how to make a ControlCollection support the DI-infrastructure:

Note, that you MUST implement the single-argument constructor ControlCollection( Control owner )!

class MyControlCollection : ControlCollection, ISupportsWebDependencyInjection
{
    private IApplicationContext _defaultApplicationContext;

    public MyControlCollection( Control owner ) : base( owner )
    {}

    public IApplicationContext DefaultApplicationContext
    {
        get { return _defaultApplicationContext; }
        set { _defaultApplicationContext = value; }
    }

    override public Add( Control child )
    {
        WebUtils.InjectDependenciesRecursive( _defaultApplicationContext, child );
        base.Add( child );
    }

    override public AddAt( int index, Control child )
    {
        WebUtils.InjectDependenciesRecursive( _defaultApplicationContext, child );
        base.AddAt( index, child );
    }
}

Requirements

Namespace: Spring.Web.Support

Assembly: Spring.Web (in Spring.Web.dll)

See Also

ISupportsWebDependencyInjection Members | Spring.Web.Support Namespace