Jef*_*eff 3 castle-windsor ioc-container activator microkernel
我正在调用Resolve的异常:
KernelException: Could not instantiate custom activator
Inner Exception:
{"Constructor on type 'MyProj.MyAdapter`1[[MyProj.MyBusinessObject, MyAsm, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found."}
Run Code Online (Sandbox Code Playgroud)
肯定有一个公共无参数构造函数(我在运行时使用反射验证了这一点)...所以我认为这个问题可能与它是通用的事实有关吗?我已经尝试获取组件模型对象并将RequiresGenericArguments设置为true,但这并没有让我在任何地方.
任何帮助将非常感激!谢谢.
Windsor没有使用默认构造函数来实例化激活器.
新版本抛出了一个更有用的异常消息:
Castle.MicroKernel.KernelException : Could not instantiate custom activator
----> System.ArgumentException : Type Castle.Windsor.Tests.ActivatorWithoutCorrectConstructor does not have a public constructor matching arguments of the following types:
Castle.Core.ComponentModel
Castle.MicroKernel.DefaultKernel
Castle.MicroKernel.ComponentInstanceDelegate
Castle.MicroKernel.ComponentInstanceDelegate
Run Code Online (Sandbox Code Playgroud)
所以你需要一个像这样的构造函数
public YourActivator(ComponentModel model, IKernel kernel,
ComponentInstanceDelegate onCreation,
ComponentInstanceDelegate onDestruction)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4201 次 |
| 最近记录: |