ArrayResolver only returning components with ctors having a single param

4 views
Skip to first unread message

JakeS

unread,
Sep 22, 2011, 11:43:35 AM9/22/11
to Castle Project Users
I have an INightlyProcess interface and 6 classes that implement it.
I have a NightlyProcessInstaller that installs all 6 classes (and I
can see them inside the kernel):

public class NightlyProcessesAppInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container,
IConfigurationStore store)
{
container.Kernel.Resolver.AddSubResolver(
new ArrayResolver(container.Kernel));

container.Register(AllTypes.FromAssembly(Assembly.GetExecutingAssembly())
.BasedOn<INightlyProcess>()
.WithService.FromInterface(typeof
(INightlyProcess))
.Configure(c =>
c.Named(c.Implementation.Name)));
}
}

And I have a class that requires an array of nightlyprocesses:

public class NightlyMaintenance
{
private readonly INightlyProcess[] _processes;
public NightlyMaintenance(INightlyProcess[] processes)
{
_processes = processes;
}
}

BUT, when the container resolves NightlyMaintenance, it's only
injecting 3 of the 6 NightlyProcesses. Examination of these shows me
that it's only injecting the processes that have constructors with a
single parameter. Any process that with a constructor having two or
more parameters is not injected.

Can anyone see what I'm doing wrong?

Jason Meckley

unread,
Sep 22, 2011, 12:47:22 PM9/22/11
to castle-pro...@googlegroups.com
the other 3 are not properly configured, so Windsor ignores them. as a test try to explicitly resolve each process. 3 should resolve, 3 should throw.

JakeS

unread,
Sep 24, 2011, 9:53:03 AM9/24/11
to Castle Project Users
Thank you for the tip. It did turn out that a dependency shared by
those three wasn't registered properly.
Reply all
Reply to author
Forward
0 new messages