我正在尝试注册从包装类的属性到类型的类型映射。这样的事情-可能(对 Inner 的所有依赖关系都应使用 Wrapper 并传递属性来构造)
public class Wrapper
{
IDependencyForWrapper _dependency;
Inner _inner;
public Inner Inner{ get { return _inner; } }
public Wrapper(IDependencyForWrapper dependency)
{
_dependency = dependency; //do other things here
_inner = new Inner();
}
}
....
container.RegisterType<Inner, Wrapper>(new InjectionConstructor(new ResolvedParameter<IDependencyForWrapper>()));