XML configuration

Ninject supports both code-based and XML configuration. An XML module is like a code module that consists of a list of type registrations via Ninject binding. All bindings can be defined in a single XML document or segregated into multiple documents. The only advantage of using XML modules over code modules is that once we have composed such a document, we can still change our type registrations without having to recompile any part of the application. However, XML modules are not as powerful as code modules; so it is recommended to use code modules unless we need this feature. Even in this case, we can only include those bindings for which we need to change the configuration at runtime in our XML module and keep other bindings ...

Get Mastering Ninject for Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.