The constructor for C is called twice, but the return value is the
same instance.
IWindsorContainer k = new WindsorContainer();
k.AddFacility<TypedFactoryFacility>();
k.Register(Component.For<IFactory>().AsFactory());
k.AddComponentLifeStyle<C>(LifestyleType.Singleton);
k.AddComponentLifeStyle<D>(LifestyleType.Singleton);
k.AddComponentLifeStyle<E>(LifestyleType.Singleton);
k.AddComponentLifeStyle<A>(LifestyleType.Transient);
k.AddComponentLifeStyle<B>(LifestyleType.Transient);
k.Resolve<C>();
public interface IFactory
{
D Create(C c);
}
public class A
{
}
public class B
{
public B(A a)
{
}
}
public class C
{
public C(B b)
{
System.Diagnostics.Trace.WriteLine("ctor");
}
public E E { get; set; }
}
public class D
{
public D(C c)
{
}
}
public class E
{
public E(C c)
{
}
}
--
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.