UserControl
C# プロジェクトにいくつかの s があり、次のコードを使用Structuremap 3
する s にアクセスしたいときに IoC コンテナーとして使用します。UserControl
var uc = new UserControlFactory().Create<MyUserControl>();
....
これはUserControlFactory
コードです:
public class UserControlFactory:IUserControlFactory
{
public T Create<T>() where T : UserControl
{
return (T) ObjectFactory.GetInstance(typeof(T));
}
}
s コンストラクターのパラメーターinterface
としていくつかの s がある場合、正常に動作します。UserControl
public class MyUserControl:UserControl
{
public MyUserControl(IMyInterface myInterface)
{
}
}
UserControl
しかし今、コンストラクターを介してオブジェクトを渡したい:
public class MyUserControl:UserControl
{
public MyUserControl(IMyInterface myInterface,MyClass object1)
{
}
}
どうやってやるの?