Options for wiring dependencies with NInject

前端 未结 4 1971
悲哀的现实
悲哀的现实 2020-12-11 06:31

With NInject (preferably 2.0), what options do we have wrt wiring up our object dependencies in a web application?

Can they be defined in an XML configuration file?

4条回答
  •  旧巷少年郎
    2020-12-11 06:51

    Ninject doesn't have XML configuration, sorry but I can't provide a direct link (cos their site has flash elements), but here is a quotation from 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.

提交回复
热议问题