Did you try to iniect IEnumerable<ISomeService>? This will inject both in
the order of registration.

Cheers,
Sunny

On Mon, Sep 10, 2018, 9:18 AM 'Jordan' via Castle Project Users <
castle-project-users@googlegroups.com> wrote:

> Hi all,
>
> If there are 2 different named implementations of an interface in the
> container, will the first one be always be automatically selected by the
> container for constructor injection?
>
> Is there any way of automatically injecting both instances into a
> constructor?  Or a dictionary of all implementations?
>
> eg if there are 2 named implementations of ISomeService,
> "defaultSomeService", and "alternativeSomeService",  and I have a
> constructor like this:
>
>
>         public SomeOtherComponent(ISomeService defaultSomeService,
> ISomeService alternativeSomeService)
>         {
>                   //................
>         }
>
> is there any way of getting the container to automatically inject both
> implementations by name? Or will "defaultSomeService" just be injected
> twice ?
>
> thanks,
> Jordan
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Castle Project Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to castle-project-users+unsubscr...@googlegroups.com.
> To post to this group, send email to castle-project-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/castle-project-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to castle-project-users+unsubscr...@googlegroups.com.
To post to this group, send email to castle-project-users@googlegroups.com.
Visit this group at https://groups.google.com/group/castle-project-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to