0
引用RegisterInstance我有以下代码:统一2故障使用InjectonProperty
统一容器:
Settings settings = CreateSettings();
container.RegisterInstance(settings)
.RegisterType<MyHttpHandler>(new InjectionProperty[]
{
// How do I tell Unity to inject my settings created above?
new InjectionProperty("Settings", new ResolvedParameter(????))
});
MyHttpHandler:
public class MyHttpHandler: IHttpHandler
{
public MyHttpHandler()
{
IoC.Inject(this);
}
public Settings Settings
{
get;
set;
}
}
我如何告诉团结注入的设置?这在接口上工作得很好,但不知道如何在这里继续。
任何帮助表示赞赏。