I'm having trouble getting Windsor (and MicroKernel) resolving chained
constructor dependencies. Am I using the container incorrectly? Is
this a bug?

For example, this test fails:

                [Test]
                public void ContainerShouldResolveChainedDependency()
                {
                        using(var container = new WindsorContainer())
                        {
                                container.AddComponent<ITestService, 
TestService>();
                                container.AddComponent<ITestService1, 
TestService1>();

                                Assert.That(container.Resolve<ITestService1>(), 
Is.Not.Null); //
this fails
                        }
                }

Here's the code for the test services. Note that TestService1 defines
a constructor dependency for ITestService.

        public interface ITestService {}

        public class TestService : ITestService {}

        public interface ITestService1 { ITestService Test { get; } }

        public class TestService1 : ITestService1
        {
                public ITestService Test { get; private set; }
                public TestService1(ITestService test) { Test = test; }
        }

And here's the exception stack trace:

at
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.SetUpProperties
(Object instance, CreationContext context)
at
Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate
(CreationContext context)
at
Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create
(CreationContext context)
at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve
(CreationContext context)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext
context)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler,
Type service, IDictionary additionalArguments)
at Castle.MicroKernel.DefaultKernel.get_Item(Type service)
at Castle.Windsor.WindsorContainer.Resolve(Type service)
at Castle.Windsor.WindsorContainer.Resolve[T]()
at MyTests.ContainerShouldResolveChainedDependency() in
MyTests.cs:line 62

--~--~---------~--~----~------------~-------~--~----~
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