Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Ninject 2 做一个项目,一个问题困扰着我:
如果要拦截类型上的方法,则需要将其包装到代理中(具体为城堡动态代理)。除非所述类型具有无参数构造函数,否则代理创建将失败。如果有,则在从内核解析类型实例时使用此构造函数。
不幸的是,这意味着我的带参数的注入构造函数被忽略了,我不得不求助于属性注入。我有些不愿意将我的域类型与属性上的 [Inject] 属性结合起来。
有没有办法使用 Ninject 将注入构造函数与 AoP 代理一起使用?
请参阅http://groups.google.com/group/ninject/browse_thread/thread/27ecdf1aafc2ec07