Hi there,
The issue IOC-ISSUE-198 was just created by Germ?n Schuager (german).
Key: IOC-ISSUE-198
Summary: Multiple constructors issue
Type: Bug
Importance: High
Description:
Given the following class:
public class Service
{
public ComponentX X { get; private set; }
public ComponentY Y { get; private set; }
public ComponentA A { get; private set; }
public Service(ComponentA a)
{
A = a;
}
public Service(ComponentX x, ComponentY y)
{
X = x;
Y = y;
}
}
and the following test:
[Test]
public void Kernel_should_select_ctor_with_available_dependencies()
{
var kernel = new DefaultKernel();
kernel.AddComponent<Service>();
kernel.AddComponent<ComponentX>();
kernel.AddComponent<ComponentY>();
var service = kernel.Resolve<Service>();
Assert.That(service.A, Is.Null);
Assert.That(service.X, Is.Not.Null);
Assert.That(service.Y, Is.Not.Null);
}
The test fails depending on the order in which the components are registered:
if Service is registered before its dependencies the test won't pass, if it is
registered after them it pass.
Related thread:
http://groups.google.com/group/castle-project-users/browse_thread/thread/edbbf8857d36610b?hl=en
For more, see
http://support.castleproject.org/projects/IOC/issues/view/IOC-ISSUE-198
--
donjon
by Castle Stronghold
http://www.castle-donjon.com
--
You received this message because you are subscribed to the Google Groups
"Castle Project Development List" 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-devel?hl=en.