You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
We want to have types registered with DynamicParameters and then be injected as properties. Simple example below, in case 2 and 3 class2 variable has Prop = null. Case 2 is preferable for us, we need access to container on type creation. Could you please suggest workaround or fix such behavior if there is a bug. Thanks in advance
public class Class1
{
private readonly int _intDep;
public Class1(int intDep)
{
_intDep = intDep;
}
}
public class Class2
{
public Class1 Prop { get; set; }
}
var container = new WindsorContainer();
container.Register(Component.For<Class1>()
.DependsOn(Dependency.OnValue("intDep", 1)) //case 1
//.DynamicParameters((kernel, args) => args["intDep"] = 1) //case 2
//.DependsOn((kernel, args) => args["intDep"] = 1) //case 3
.LifestyleTransient());
container.Register(Component.For<Class2>().LifestyleTransient());
var class1 = container.Resolve<Class1>(); //ok - integer injected for all cases
var class2 = container.Resolve<Class2>(); //null Prop for case 2 and 3
The text was updated successfully, but these errors were encountered:
Hi,
We want to have types registered with DynamicParameters and then be injected as properties. Simple example below, in case 2 and 3 class2 variable has Prop = null. Case 2 is preferable for us, we need access to container on type creation. Could you please suggest workaround or fix such behavior if there is a bug. Thanks in advance
The text was updated successfully, but these errors were encountered: