带参数的 Ninject Interceptors 类
简单的问题...我想使用 Ninject 拦截器来处理我的 NFR,但是我的很多类都需要构造函数中的参数。我读到他们正在考虑允许带参数的构造函数,但目前我收到一个错误:
Can not instantiate proxy of class: myClass
Could not find a parameterless constructor.
Parameter name: constructorArguments
我正在使用版本 2.2.1 我想,注意到扩展网站上有一个标记的 2.3 版本,但这会解决我的问题吗?如果没有,有什么办法解决这个问题吗?
Simple question... I want to use Ninject Interceptors to take care of my NFRs, however alot of my classes require arguments in the constructors. I read that they are looking at allowing constructors with arguments but currently I get an error:
Can not instantiate proxy of class: myClass
Could not find a parameterless constructor.
Parameter name: constructorArguments
I am using version 2.2.1 I think, noticed there is a tagged 2.3 version on the extensions site, but will any of this solve my problems? if not is there any way around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
2.3 添加了对接口代理的支持。这意味着它将解决所有通过接口解决的类型的问题。它还计划添加对没有默认构造函数的类的支持。
但请注意 2.3 正在开发中。虽然没有任何已知的新问题,但它尚未像 2.2 那样针对实际应用程序进行测试,并且新内容的界面更改仍然可以更改。 InRequestScope 对 XML 和约定的支持也已暂时禁用。
2.3 adds support for Interface proxies. This means it will solve the problem for all types that are resolved by interface. It's also planned to add support for classes without default constructor.
But be aware that 2.3 is work in progress. While there aren't any known new problems it is not tested yet against real applications as 2.2 is and interface changes of new stuff can still change. Also InRequestScope support for XML and Conventions has temporarily been disabled.