Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 841 Bytes

forwarded-types.md

File metadata and controls

31 lines (23 loc) · 841 Bytes

Forwarded Types

Forwarded types are additional services exposed by a component. For example, given the following component:

public class FooBar : IFoo, IBar
{
    public void DoFoo()
    {
        // some implementation
    }

    public void DoBar()
    {
        // some implementation
    }
}

Windsor will let you expose this single component as both IFoo and IBar service.

//register FooBar as both IFoo and IBar with singleton lifestyle

var foo = container.Resolve<IFoo>();
var bar = container.Resolve<IBar>();

Debug.Assert(object.ReferenceEquals(foo, bar));

This can be done either via fluent registration API or XML configuration.