asp.net – 使用NInject连接依赖项的选项

前端之家收集整理的这篇文章主要介绍了asp.net – 使用NInject连接依赖项的选项前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用NInject(最好是2.0),我们在Web应用程序中连接对象依赖项时有哪些选项?

它们可以在XML配置文件中定义吗?

还是必须通过代码完成?

解决方法

Ninject没有XML配置,对不起但我无法提供直接链接(因为他们的网站有flash元素),但这里是 ninject.org的报价:

Free yourself from XML

Most other .NET dependency injection frameworks are designed around the use of XML to declare type bindings. Rather than forcing you to write cumbersome and error-prone text,Ninject arms you with a fluent interface,which lets you connect the pieces of your application using full-fledged code. This means you can take advantage of the features of the IDE and compiler,like code completion and type-safety.

猜你在找的asp.Net相关文章