IoC.Configuration
=================
**IoC.Configuration** is a container agnostic configuration of dependency injection.
`IoC.Configuration `_ is a wrapper around popular **IoC** containers, with additional functionality (see below). Currently `Ninject `_ and `Autofac `_ are supported through the usage of Nuget extension packages `IoC.Configuration.Ninject `_ and `IoC.Configuration.Autofac `_.
Among other things, it allows:
- Specifying dependency injection configuration in XML configuration file, as well as in **IoC.Configuration** module classes, or third party IoC container modules (e.g., **Autofac** or **Ninject** modules).
- Easy switching between containers to use for service resolution (e.g., **Autofac**, **Ninject**).
In addition, the configuration file has sections for settings, plugins, startup actions, dynamically generated implementations of interfaces (see :doc:`./xml-configuration-file/autogenerated-services/index`), etc.
All these functionality will be explained in corresponding sections, however here is a quick overview:
- The dependency injection bindings are done using any combination of the following techniques:
- In **IoC.Configuration** module classes using chained methods, pretty similar to how it is done in popular containers, **Ninject** and **Autofac**.
.. note::
The **IoC.Configuration** module classes should either implement **IoC.Configuration.DiContainer.IDiModule**, or extend the class **IoC.Configuration.DiContainer.ModuleAbstr**, and override the method **Load()**.
- In module classes of one of popular **IoC** packages (such as **Autofac** or **Ninject**). These modules will be referred as native modules.
- In XML configuration file. This method is the preferred way to configure the dependency injection, since it is the most flexible. XML configuration files have sections for type bindings, as well as sections for **IoC.Configuration** or native (i.e., **Autofac**, **Ninject**, etc) modules.
.. note::
**IoC.Configuration** has its own syntax for type bindings, which reminds the syntax used in `Ninject `_. However, **IoC.Configuration** translates these type bindings into 3-rd party **IoC** container (e.g., **Autofac**, **Ninject**, etc) bindings .
- Type resolutions are done using one of popular **IoC** containers (e.g., **Autofac**, **Ninject**, etc), through the usage of implementations of **IoC.Configuration.DiContainer.IDiManager** interface.
.. note::
Currently, two implementations of **IoC.Configuration.DiContainer.IDiManager** are availabe, **Ninject** and **Autofac** implementations). These implementations are in packages `IoC.Configuration.Ninject `_ and `IoC.Configuration.Autofac `_.
- The container (e.g., **Autofac**, **Ninject**) used by **IoC.Configuration** can be switched in XML configuration file.
Here is an exert from :doc:`./sample-files/IoCConfiguration_Overview.generated`, that shows the usage of element **diManagers** to specify container for resolving types:
.. code-block:: xml
.. toctree::
sample-files/index.rst
bindings-in-modules/index.rst
xml-configuration-file/index.rst
loading-ioc-configuration/index.rst
resolving-types/index.generated.rst
application-integration/index.rst
troubleshooting/index.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`