Yes, like the linked thread you can use a sub dependency resolver. There are 2 baked into MicroKernel (for arrays and lists, however an IEnumerable<T> should be just as easy).
You register it as follows: Kernel.Resolver.AddSubResolver(new ArrayResolver(Kernel)); http://svn.castleproject.org:8080/svn/castle/trunk/InversionOfControl/Castle.MicroKernel/Resolvers/SpecializedResolvers/ On Mon, Oct 12, 2009 at 7:21 PM, Thejuan <[email protected]> wrote: > I tried posting this before, didn't seem to work. Sorry if you got it > twice. > It's in response to > > http://groups.google.com/group/castle-project-users/browse_thread/thread/831d5862dccf13e2/4bd4dbaa051f7089?lnk=gst&q=IEnumerable#4bd4dbaa051f7089 > > I have the same problem. Here is a test to show the problem. > Is there away to acheive the same thing a different way? > > > [Test] > public void Bug() > { > WindsorContainer container = new WindsorContainer(); > container.AddFacility<FactorySupportFacility>(); > container.Register(Component.For<IService> > ().ImplementedBy<Service1>().Named("1")); > container.Register(Component.For<IService> > ().ImplementedBy<Service2>().Named("2")); > container.Register(Component.For<IEnumerable<IService>> > ().UsingFactoryMethod(() => container.ResolveAll<IService>())); > container.Register(Component.For<Consumer>()); > > Assert.IsNotNull(container.Kernel.Resolve<Consumer>()); > } > > public class Consumer > { > public Consumer(IEnumerable<IService> services) { } > } > > public class Service1 : IService > { > > } > > public class Service2 : IService > { > > } > > public interface IService { } > > > > > -- Jono --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
