Hello Krzysztof,

Sorry for not replying before, but I was waiting for a branch in our source
code before testing that (as we were close to a release)
As we currently only have one kind of array, I registered this array
manually (as a work around):

container.Register(Component.For<IScheduler[]>()
                                .UsingFactoryMethod(kernel =>
kernel.ResolveAll<IScheduler>())
                                .LifestyleTransient());

Now the branch is done, so I'm trying to find a global solution for all
kind of arrays

I've tried your solution, but I don't find any LazyServiceStrategy type ?

I'm using Windsor 3.0, so maybe it's something that came later ?



On Tue, Feb 26, 2013 at 9:15 PM, Krzysztof Kozmic <
[email protected]> wrote:

>  Fabrice,
>
> This is a known limitation.
>
> I think it may work however, if you register support for lazy explicitly
>
> Component.For(typeof(Lazy<>))
> .ImplementedBy(typeof(LazyEx<>), LazyServiceStrategy.Instance)
> .LifeStyle.Transient
>
> instead of LazyOfTComponentLoader
>
> --
> Krzysztof Kozmic
>
> On Wednesday, 27 February 2013 at 1:47 AM, Fabrice wrote:
>
> Hi
>
> I've a CTor like this:
> public CompanyComponent(ILogger logger, Lazy<IScheduler[]> schedulers)
>
> I've configured my container to add Lazy & Collection feature:
>
> this.container = new
> DF.ApplicationBlocks.ApplicationContainer.Container(); // This is my
> subclass of WindsorContainer
>
> // Handle collection & array
> container.Kernel.Resolver.AddSubResolver(new
> CollectionResolver(container.Kernel));
>
> // Register lazy loading
>
> container.Register(Component.For<ILazyComponentLoader>().ImplementedBy<LazyOfTComponentLoader>());
>
> These lines are set before registering any component.
>
> Then when I try to resolve the CompanyComponent:
>
> Castle.MicroKernel.ComponentNotFoundException was unhandled
>   HelpLink=groups.google.com/group/castle-project-users
>   HResult=-2146233088
>   Message=No component for supporting the service
> DF.MailFlow.WorkerService.IScheduler[] was found
>   Source=Castle.Windsor
>
> If I use DebuggerVisualizer:
> Some dependencies of this component could not be statically resolved.
> 'DF.MailFlow.WorkerService.CompanyComponent' is waiting for the following
> dependencies:
> - Service 'System.Lazy`1[[DF.MailFlow.WorkerService.IScheduler[],
> DF.MailFlow.WorkerService, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=1eb1c673988515c1]]' which was not registered.
>
> To know if the problem was coming from Lazy or from Array, using immediate
> window I've tried to resolve:
> - IScheduler : succeeded
> - IScheduler[]: failed
> - List<IScheduler>: failed
> - IList<IScheduler>: failed
> - Lazy<IScheduler>: succeeded
>
> So it's seems it comes from the array. I've also tried using the "old"
> ArrayResolver, but same problem. I've added 2 screenshot with more details
> on the container content and on the exception.
>
> I've 6 IScheduler component registered, so does someone have an idea on
> why it throw this exception ?
>
> Thank you
> Fabrice
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected]
> .
> Visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> Attachments:
>  - 2013-02-26_16h29_41.png
>  - 2013-02-26_16h27_01.png
>
>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected]
> .
> Visit this group at
> http://groups.google.com/group/castle-project-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/castle-project-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to