"you introduced extra coupling":
I didn't, because it is just the type of service.

there is a story why I need this. DefaultComponent will behave
differently depending on the type of service.
just want to know is it possible to config windsor to do this?

On Mar 25, 5:26 pm, Dmitry Kryuchkov <[email protected]> wrote:
> Why does DefaultComponent need to know type of service that it belongs
> for? I think it is weird and you introduced extra coupling in your
> application.
>
> On Mar 24, 1:10 am, Jin <[email protected]> wrote:
>
>
>
>
>
>
>
> > 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