Ninject是一個快如閃電、超輕量級的基於.Net平台的依賴注入框架。
簡介,官方解釋,
簡介
它能夠幫助你把應用程式分離成一個個松耦合、高內聚的模組,然後用一種靈活的方式組裝起來。通過使用Ninject配套你的軟體架構,那么代碼將會變得更加容易編寫、重用性強、易於測試和修改。
官方解釋
- '''Focused.''' Too many existing dependency injection projects sacrifice usability for features that aren't often necessary. Each time a feature is added to Ninject, its benefit is weighed against the complexity it adds to everyday use. Our goal is to keep the barrier to entry - the baseline level of knowledge required to use Ninject - as low as possible. Ninject has many advanced features, but understanding them is not required to use the basic features.
- '''Sleek.''' Framework bloat is a major concern for some projects, and as such, all of Ninject's core functionality is in a single assembly with no dependencies outside the .NET base class library. This single assembly's footprint is approximately 140KB when compiled for release.
- '''Fast.''' Instead of relying on reflection for invocation, Ninject can take advantage of the lightweight code generation features in version 2.0 of the CLR. This can result in a dramatic (8-50x) improvement in performance in many situations.
- '''Precise.''' Ninject helps developers get things right the first time around. Rather than relying on XML mapping files and string identifiers to wire up components, Ninject provides a robust domain-specific language. This means that Ninject takes advantage of the capabilities of the language (like type-safety) and the IDE (like IntelliSense and code completion).
- '''Agile.''' Ninject is designed around a component-based architecture, with customization and evolution in mind. Many facets of the system can be augmented or modified to fit the requirements of each project.
- '''Stealthy.''' In spite of its use of .NET attributes, Ninject will not invade your code. You can easily isolate the dependency on Ninject to a single assembly in your project.
- '''Powerful.''' Ninject includes many advanced features. For example, Ninject is the first dependency injector to support contextual binding, in which a different concrete implementation of a service may be injected depending on the context in which it is requested.