ウィンザー城でこれを行うことができます:
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 });
これはUnityで可能ですか?私はそれをやろうとしましたが、コンストラクターが見つからないと不平を言います。サブタイプ経由でしか注入できないようです。