我有一个包含usercontrol的winform。该usercontrol具有依赖关系,我需要使用unity来解决。使用构造函数注入的问题是用户控件在winform的设计器的InitializeComponent中实例化。因此我无法放置容器。解决那里。
有什么替代方案?
答案 0 :(得分:1)
我相信你会想要使用Property Injection和BuildUp:
Using BuildUp to Wire Up Objects Not Created by the Container
构造函数注入通常是首选方法,但正如您所指出的那样,在处理WinForm控件时是不可能的。