【发布时间】:2009-01-21 07:07:34
【问题描述】:
我正在按照在线教程学习 Castle.windsor。这是简单的示例代码:
public class Form1 {
private readonly HttpServiceWatcher serviceWatcher;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
public Form1(HttpServiceWatcher serviceWatcher) : this()
{
this.serviceWatcher = serviceWatcher;
}
}
HttpServiceWatcher 在 xml 配置文件中。
我的问题是:谁在调用具有参数的构造函数:public Form1(Http....)?
在 program.cs 我有这个:
container.AddComponent("form.component",typeof(Form1));
Form1 form1 = (Form1) container["form.component"];
Application.Run(form1);
【问题讨论】:
-
您应该更好地格式化您的问题代码。目前是一堆废话。 (我会自己做,如果我有代表的话......)
标签: castle-windsor