public interface IComponent
{
}

public class DefaultComponent : IComponent
{
    private readonly Type _service;

    public DefaultComponent(Type service)
    {
        _service = service;
    }
}

public interface IService
{
}

public class DefaultService : IService
{
    private readonly IComponent _component;

    public DefaultService(IComponent component)
    {
        _component = component;
    }
}

public class OtherService : IService
{
    private readonly IComponent _component;

    public OtherService(IComponent component)
    {
        _component = component;
    }
}

when I user service, IComponent should created as per the type of
service I'm using. eg:

IComponent component1 = new DefaultComponent(typeof (DefaultService));
IService defaultService = new DefaultService(component1);

IComponent component2 = new DefaultComponent(typeof (OtherService));
IService otherService = new OtherService(component2);

So how to config windsor to do this?

Thanks,
Jing

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to