1
私は城ウィンザーでこれを行うことができます。Unityを使用して保護されたコンストラクタにパラメータを挿入することはできますか?
public abstract class AbstractFactory
{
protected AbstractFactory(Foo constructorParm)
{
// Do something with parameter...
}
}
public class DescendentFactory : AbstractFactory
{
public DescendentFactory(Foo constructorParm) : base(constructorParm)
{
}
}
// The container is configured via XML, the service AbstractFactory and the
// type DescendentFactory
container.Resolve<AbstractFactory>("DescendentFactoryId", new { constructorParm = injectedValue });
はユニティで、このことは可能ですか?私はそれをやってみたが、それはコンストラクタを見つけることができないと文句を言う。私はサブタイプでしか注入できないようです。