IoC.Configuration 2.2.1

dotnet add package IoC.Configuration --version 2.2.1
                    
NuGet\Install-Package IoC.Configuration -Version 2.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IoC.Configuration" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IoC.Configuration" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="IoC.Configuration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IoC.Configuration --version 2.2.1
                    
#r "nuget: IoC.Configuration, 2.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=IoC.Configuration&version=2.2.1
                    
Install IoC.Configuration as a Cake Addin
#tool nuget:?package=IoC.Configuration&version=2.2.1
                    
Install IoC.Configuration as a Cake Tool

NOTE, following is a very high level description of IoC.Configuration. For more details please refer to a more complete documentation at http://iocconfiguration.readthedocs.io, and also look at configuration files in https://github.com/artakhak/IoC.Configuration/tree/master/IoC.Configuration.Tests and the tests that use these files.


The main functions of IoC.Configuration library are:

  1. Container agnostic configuration of dependency injection using XML configuration file. The file has section where container can be specified, that will be handling dependency injection resolutions. Currently two popular containers are supported, Ninject and Autofac, via extension libraries IoC.Configuration.Ninject and IoC.Configuration.Autofac, that are available in Nuget.org. The dependency injection container (e.g., Autofac, Ninject) can be easily switched in configuration file. In addition, the configuration file has sections for settings, plugins, startup actions, dynamically generated implementations of interfaces (see elements iocConfiguration/dependencyInjection/autoGeneratedServices/autoService and iocConfiguration/dependencyInjection/autoGeneratedServices/autoServiceCustom in example configuration files in GitHub test project IoC.Configuration.Tests).

  2. Container agnostic configuration of dependency injection in code.


The bindings are specified using IoC.Configuration chained methods, however the actual resolutions are done using one of the popular dependency injection containers, Ninject and Autofac, via extension libraries IoC.Configuration.Ninject and IoC.Configuration.Autofac.


Configuration

Dependency injection can be configured either using file based or code based configuration builder.

Bindings can be specified in three different ways:

-In configuration file (for file based configuration only).

-Using native modules (for example using Autofac and Ninject modules).

-By extending the class IoC.Configuration.DiContainer.ModuleAbstr and overriding the method AddServiceRegistrations() or by implementing IoC.Configuration.IDiModule.

In file based configuration, the modules (Autofac, Ninject, or implementations of IoC.Configuration.IDiModule) can be specified in configuration file in element iocConfiguration/dependencyInjection/modules/module

In code based configuration, the modules can be passed as parameters in chained configuration methods (see the section Code Based Configuration).

Below is an example of specifying bindings in AddServiceRegistrations() method in a subclass of IoC.Configuration.DiContainer.ModuleAbstr (note the example is taken from test project so the class names are not user friendly).

// This file is used in documentation as demo
using IoC.Configuration.DiContainer;
using System.Collections.Generic;
using IoC.Configuration.Tests.SuccessfulDiModuleLoadTests.TestClasses;

namespace IoC.Configuration.Tests.SuccessfulDiModuleLoadTests;

public class TestDiModule : IoC.Configuration.DiContainer.ModuleAbstr
{
    protected override void AddServiceRegistrations()
    {
        Bind<Class1>().ToSelf()
            .SetResolutionScope(DiResolutionScope.Singleton);
        Bind<IInterface1>().To<Interface1_Impl1>()
            .SetResolutionScope(DiResolutionScope.Singleton);
        Bind<Class2>().ToSelf()
            .SetResolutionScope(DiResolutionScope.Transient);
        Bind<IInterface2>().To<Interface2_Impl1>()
            .SetResolutionScope(DiResolutionScope.Transient);
        Bind<Class3>().ToSelf()
            .SetResolutionScope(DiResolutionScope.ScopeLifetime);
        Bind<IInterface3>().To<Interface3_Impl1>()
            .SetResolutionScope(DiResolutionScope.ScopeLifetime);
        Bind<Class4>().ToSelf()
            .SetResolutionScope(DiResolutionScope.Singleton);
        Bind<Class4>().ToSelf()
            .SetResolutionScope(DiResolutionScope.Transient);

        // The first binding should be with Singleton scope, and the second
        // should with Transient, so that we can test that the first binding was used.
        Bind<Class5>().OnlyIfNotRegistered()
            .ToSelf().SetResolutionScope(DiResolutionScope.Singleton);
        Bind<Class5>().OnlyIfNotRegistered()
            .ToSelf().SetResolutionScope(DiResolutionScope.Transient);

        // Only the first binding below will be registered.
        Bind<IInterface4>().OnlyIfNotRegistered().To<Interface4_Impl1>()
            .SetResolutionScope(DiResolutionScope.Transient);
        Bind<IInterface4>().OnlyIfNotRegistered().To<Interface4_Impl2>()
            .SetResolutionScope(DiResolutionScope.Singleton);

        // Both binding below will be registered
        Bind<IInterface5>().OnlyIfNotRegistered()
            .To<Interface5_Impl1>()
            .SetResolutionScope(DiResolutionScope.Transient);
        Bind<IInterface5>().To<Interface5_Impl2>()
            .SetResolutionScope(DiResolutionScope.Singleton);

        // Test delegates and resolution using IDiContainer
        Bind<IInterface6>()
            .To(diContainer => new Interface6_Impl1(11, diContainer.Resolve<IInterface1>()));

        // Test delegates that return a collection using IDiContainer
        Bind<IEnumerable<IInterface7>>().To(x => new List<IInterface7>()
        {
            new Interface7_Impl1(10),
            new Interface7_Impl1(11)
        }).SetResolutionScope(DiResolutionScope.Singleton);

        Bind<IInterface8>().To<Interface8_Impl1>().SetResolutionScope(DiResolutionScope.Singleton);

        #region Test circular references

        Bind<ICircularReferenceTestInterface1>()
            .To<CircularReferenceTestInterface1_Impl>()
            .OnImplementationObjectActivated(
                (diContainer, instance) =>
                    // Note, type of parameter 'instance' is the implementation type
                    // CircularReferenceTestInterface1_Impl. So we can use Property1 setter in
                    // CircularReferenceTestInterface1_Impl only and not in ICircularReferenceTestInterface1.
                    // ICircularReferenceTestInterface1 has only getter for Property1.
                    instance.Property1 = diContainer.Resolve<ICircularReferenceTestInterface2>())
            .SetResolutionScope(DiResolutionScope.Singleton);

        Bind<ICircularReferenceTestInterface2>().To<CircularReferenceTestInterface2_Impl>()
            .SetResolutionScope(DiResolutionScope.Singleton);
        #endregion
    }
}

File Based Configuration

Example of configuration file is shown below.

Here is an example of configuring and starting the container:

        
TestsSharedLibrary.TestsHelper.SetupLogger();

var configurationFileContentsProvider = new FileBasedConfigurationFileContentsProvider(
                Path.Combine(Helpers.TestsEntryAssemblyFolder, "IoCConfiguration_Overview.xml"));

using (var containerInfo = new DiContainerBuilder.DiContainerBuilder()
           .StartFileBasedDi(
               new FileBasedConfigurationParameters(configurationFileContentsProvider,
                   Helpers.TestsEntryAssemblyFolder,
                   new LoadedAssembliesForTests())
               {
                   AdditionalReferencedAssemblies = new []
                   {
                       // List additional assemblies that should be added to dynamically generated assembly as references
                       Path.Combine(Helpers.GetTestFilesFolderPath(), @"DynamicallyLoadedDlls\TestProjects.DynamicallyLoadedAssembly1.dll"),
                       Path.Combine(Helpers.GetTestFilesFolderPath(), @"DynamicallyLoadedDlls\TestProjects.DynamicallyLoadedAssembly2.dll")
                   },
                   AttributeValueTransformers = new[] {new FileFolderPathAttributeValueTransformer()},
                   ConfigurationFileXmlDocumentLoaded = (sender, e) =>
                   {
                       // Replace some elements in e.XmlDocument if needed,
                       // before the configuration is loaded.
                       Helpers.EnsureConfigurationDirectoryExistsOrThrow(e.XmlDocument.SelectElement("/iocConfiguration/appDataDir").GetAttribute("path"));
                   }
               }, out _)
           .WithoutPresetDiContainer()
           .AddAdditionalDiModules(new TestDiModule())
           .RegisterModules()
           .Start())
{
    var container = containerInfo.DiContainer;

    Assert.IsNotNull(containerInfo.DiContainer.Resolve<IInterface6>());

    var settings = container.Resolve<ISettings>();
    Assert.AreEqual(155.7, settings.GetSettingValueOrThrow<double>("MaxCharge"));

    var pluginRepository = container.Resolve<IPluginDataRepository>();

    var pluginData = pluginRepository.GetPluginData("Plugin1");
    Assert.AreEqual(38, pluginData.Settings.GetSettingValueOrThrow<long>("Int64Setting1"));
}

The configuration file IoCConfiguration_Overview.xml available in https://github.com/artakhak/IoC.Configuration/tree/master/IoC.Configuration.Tests


<?xml version="1.0" encoding="utf-8"?>




<iocConfiguration
	xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
	xsi:noNamespaceSchemaLocation="http://oroptimizer.com/IoC.Configuration/V2/IoC.Configuration.Schema.7579ADB2-0FBD-4210-A8CA-EE4B4646DB3F.xsd">

	
	
	<appDataDir
		path="TestFiles\AutogeneratedDlls\IoCConfiguration_Overview" />

	<plugins pluginsDirPath="TestFiles\PluginDlls">

		

		
		<plugin name="Plugin1" />
		<plugin name="Plugin2" />
		<plugin name="Plugin3" enabled="false" />
	</plugins>

	<additionalAssemblyProbingPaths>
		<probingPath
			path="TestFiles\ThirdPartyLibs" />
		<probingPath
			path="TestFiles\ContainerImplementations\Autofac" />
		<probingPath
			path="TestFiles\ContainerImplementations\Ninject" />

		<probingPath
			path="TestFiles\DynamicallyLoadedDlls" />
		<probingPath
			path="TestFiles\TestAssemblyResolution" />
	</additionalAssemblyProbingPaths>

	<assemblies>
		
		<assembly name="OROptimizer.Shared" alias="oroptimizer_shared" />
		<assembly name="IoC.Configuration" alias="ioc_config" />
		<assembly name="IoC.Configuration.Autofac" alias="autofac_ext" />
		<assembly name="IoC.Configuration.Ninject" alias="ninject_ext" />

		<assembly name="TestProjects.Modules" alias="modules" />

		
		<assembly name="TestProjects.DynamicallyLoadedAssembly1"
				  alias="dynamic1" overrideDirectory="TestFiles\DynamicallyLoadedDlls"/>

		<assembly name="TestProjects.DynamicallyLoadedAssembly2"
		          alias="dynamic2" />

		<assembly name="TestProjects.TestPluginAssembly1"
				  alias="pluginassm1" plugin="Plugin1" />

		<assembly name="TestProjects.ModulesForPlugin1"
				  alias="modules_plugin1" plugin="Plugin1" />

		<assembly name="TestProjects.Plugin1WebApiControllers"
				  alias="plugin1api" plugin="Plugin1" />


		<assembly name="TestProjects.TestPluginAssembly2"
				  alias="pluginassm2" plugin="Plugin2" />

		<assembly name="TestProjects.ModulesForPlugin2"
				  alias="modules_plugin2" plugin="Plugin2"/>

		<assembly name="TestProjects.TestPluginAssembly3"
				  alias="pluginassm3" plugin="Plugin3" />

		<assembly name="TestProjects.SharedServices" alias="shared_services" />

		<assembly name="IoC.Configuration.Tests" alias="tests" />
	</assemblies>

	<typeDefinitions>
		
		<typeDefinition alias="ReadOnlyListOf_IInterface1" type="System.Collections.Generic.IReadOnlyList[SharedServices.Interfaces.IInterface1]" />

		
		<typeDefinition alias="enumerableOfArray" type="System.Collections.Generic.IEnumerable[SharedServices.Interfaces.IInterface1#]" />

		
		<typeDefinition alias="listOfArray" type="System.Collections.Generic.IList" >
			<genericTypeParameters>
				<typeDefinition type="SharedServices.Interfaces.IInterface1#" />
			</genericTypeParameters>
		</typeDefinition>

		<typeDefinition alias="AutoService_IInterface1" type="IoC.Configuration.Tests.AutoService.Services.IInterface1" />
		<typeDefinition alias="IActionValidator" type="SharedServices.Interfaces.IActionValidator" />
		<typeDefinition alias="IProjectGuids" type="IoC.Configuration.Tests.AutoService.Services.IProjectGuids" />
		<typeDefinition alias="ActionTypes" type="SharedServices.DataContracts.ActionTypes" />
		<typeDefinition alias="Guid" type="System.Guid" />
		<typeDefinition alias="ListOfInt" type="System.Collections.Generic.List[System.Int32]" >
		</typeDefinition>
	</typeDefinitions>

	
	<parameterSerializers serializerAggregatorType="OROptimizer.Serializer.TypeBasedSimpleSerializerAggregator"
						  assembly="oroptimizer_shared">
		
		
		<serializers>
			<parameterSerializer type="OROptimizer.Serializer.TypeBasedSimpleSerializerDouble" />
			<parameterSerializer type="OROptimizer.Serializer.TypeBasedSimpleSerializerLong" />
			<parameterSerializer type="OROptimizer.Serializer.TypeBasedSimpleSerializerInt"/>
			<parameterSerializer type="OROptimizer.Serializer.TypeBasedSimpleSerializerShort"/>
			<parameterSerializer type="OROptimizer.Serializer.TypeBasedSimpleSerializerByte" />
			<parameterSerializer type="OROptimizer.Serializer.TypeBasedSimpleSerializerBoolean" />
			<parameterSerializer type="OROptimizer.Serializer.TypeBasedSimpleSerializerDateTime" />
			<parameterSerializer type="OROptimizer.Serializer.TypeBasedSimpleSerializerString" />
			<parameterSerializer type="TestPluginAssembly1.Implementations.DoorSerializer" />
			<parameterSerializer type="TestPluginAssembly2.Implementations.WheelSerializer" />

			<parameterSerializer type="TestPluginAssembly1.Implementations.UnsignedIntSerializerWithParameters" >
				<parameters>
					<int32 name="param1" value="25" />
					<double name="param2" value="36.5" />
				</parameters>
			</parameterSerializer>
		</serializers>

	</parameterSerializers>

	
	<diManagers activeDiManagerName="Autofac">
		<diManager name="Ninject" type="IoC.Configuration.Ninject.NinjectDiManager">
			
			
		</diManager>

		<diManager name="Autofac" type="IoC.Configuration.Autofac.AutofacDiManager">
		</diManager>
	</diManagers>

	
	<settingsRequestor type="SharedServices.FakeSettingsRequestor">
	</settingsRequestor>

	<settings>
		<int32 name="SynchronizerFrequencyInMilliseconds" value="5000"  />
		<double name="MaxCharge" value="155.7" />
		<string name="DisplayValue" value="Some display value" />

		
		<constructedValue name="DefaultDBConnection" type="SharedServices.Implementations.SqliteDbConnection">
			<parameters>
				<string name="filePath" value="c:\SQLiteFiles\MySqliteDb.sqlite"/>
			</parameters>
		</constructedValue>

		<object name="Project1Guid" typeRef="Guid" value="EA91B230-3FF8-43FA-978B-3261493D58A3" />
		<object name="Project2Guid" typeRef="Guid" value="9EDC7F1A-6BD6-4277-9015-5A9277218681" />

		<constructedValue name="Interface11_Value" type="SharedServices.Implementations.Interface11_Impl1">
			<parameters>
				
				<constructedValue name="param1" type="SharedServices.Implementations.Interface10_Impl1" >
					<parameters>
						<int32 name="param1" value="13" />
					</parameters>
					<injectedProperties>
						<string name="Property2" value="Value 1"/>
					</injectedProperties>
				</constructedValue>
			</parameters>

			<injectedProperties>
				
				<constructedValue name="Property2" type="SharedServices.Implementations.Interface10_Impl1" >
					<parameters>
						<int32 name="param1" value="17"/>
					</parameters>
					<injectedProperties>
						<string name="Property2" value="Value 2"/>
					</injectedProperties>
				</constructedValue>

			</injectedProperties>
		</constructedValue>

		
		<constructedValue name="Collections" type="IoC.Configuration.Tests.Collection.Services.DemoCollectionInjection">
			<parameters>
				
				<collection name="intValues" collectionType="readOnlyList" itemType="System.Int32">
					<int32 value="17"/>
					<int32 value="14"/>
				</collection>
			</parameters>
			<injectedProperties>
				
				<collection name="Texts" collectionType="readOnlyList" itemType="System.String">
					<string value="ABC, Inc"/>
					<string value="Microsoft"/>
				</collection>
			</injectedProperties>
		</constructedValue>

		<boolean name="failCustomServiceValidation" value="false"/>
	</settings>

	
	<webApi>
		<controllerAssemblies>
			
			<controllerAssembly assembly="dynamic1"></controllerAssembly>
		</controllerAssemblies>
	</webApi>

	<dependencyInjection>
		<modules>
			<module type="IoC.Configuration.Tests.PrimitiveTypeDefaultBindingsModule" >
				<parameters>
					
					<datetime name="defaultDateTime" value="1915-04-24 00:00:00.000" />
					<double name="defaultDouble" value="0" />
					<int16 name="defaultInt16" value="0" />
					<classMember name="defaultInt32" class="System.Int32" memberName="MinValue"/>
				</parameters>				
			</module>

			
			<module type="Modules.Autofac.AutofacModule1" >
				<parameters>
					<int32 name="param1" value="1" />
				</parameters>
			</module>

			
			<module type="Modules.IoC.DiModule1" >
				<parameters>
					<int32 name="param1" value="2" />
				</parameters>
			</module>

			
			<module type="Modules.Ninject.NinjectModule1" >
				<parameters>
					<int32 name="param1" value="3" />
				</parameters>
			</module>

			<module type="IoC.Configuration.Tests.AutoService.AutoServiceTestsModule" />
		</modules>
		<services>
			<service type="DynamicallyLoadedAssembly1.Interfaces.IInterface1">
				<implementation type="DynamicallyLoadedAssembly1.Implementations.Interface1_Impl1"
								scope="singleton">
				</implementation>
			</service>

			<service type="DynamicallyLoadedAssembly1.Interfaces.IInterface2">
				<implementation type="DynamicallyLoadedAssembly1.Implementations.Interface2_Impl1"
								scope="transient">
				</implementation>
			</service>

			<service type="DynamicallyLoadedAssembly1.Interfaces.IInterface3">
				<implementation type="DynamicallyLoadedAssembly1.Implementations.Interface3_Impl1"
								scope="scopeLifetime">
				</implementation>
			</service>

			
			<service type="SharedServices.Interfaces.IInterface9">
				<implementation type="SharedServices.Implementations.Interface9_Impl1"
								scope="singleton" />
			</service>
			<service type="SharedServices.Interfaces.IInterface8">
				<implementation type="SharedServices.Implementations.Interface8_Impl1"
								scope="singleton">
					
					<parameters>
					</parameters>
				</implementation>

				<implementation type="SharedServices.Implementations.Interface8_Impl2" scope="singleton">
					
				</implementation>
			</service>

			
			<selfBoundService type="DynamicallyLoadedAssembly1.Implementations.SelfBoundService1"
							  scope="singleton">
				<parameters>
					<int32 name="param1" value="14" />
					<double name="param2" value="15.3" />
					<injectedObject name="param3" type="DynamicallyLoadedAssembly1.Interfaces.IInterface1" />
				</parameters>
			</selfBoundService>

			
			<selfBoundService type="DynamicallyLoadedAssembly1.Implementations.SelfBoundService2"
							  scope="transient">
				<injectedProperties>
					<int32 name="Property1" value="17" />
					<double name="Property2" value="18.1" />
					<injectedObject name="Property3" type="DynamicallyLoadedAssembly1.Interfaces.IInterface1" />
				</injectedProperties>
			</selfBoundService>

			
			<selfBoundService type="DynamicallyLoadedAssembly1.Implementations.SelfBoundService3"
							  scope="scopeLifetime">
			</selfBoundService>

			
			<service type="SharedServices.Interfaces.IInterface3" >
				<implementation type="SharedServices.Implementations.Interface3_Impl1"
								scope="singleton">
					<injectedProperties>
						<injectedObject name="Property2" type="SharedServices.Interfaces.IInterface4" />
					</injectedProperties>
				</implementation>
			</service>
			<service type="SharedServices.Interfaces.IInterface4">
				<implementation type="SharedServices.Implementations.Interface4_Impl1"
								scope="singleton">
				</implementation>
			</service>

			
			<service type="SharedServices.Interfaces.IInterface2" >
				
				<implementation type="SharedServices.Implementations.Interface2_Impl1"
								scope="singleton">
					<parameters>
						
						<datetime name="param1" value="2014-10-29 23:59:59.099" />
						<double name="param2" value="125.1" />
						<injectedObject name="param3" type="SharedServices.Interfaces.IInterface3" />
					</parameters>
				</implementation>

				
				<implementation type="SharedServices.Implementations.Interface2_Impl2"
								scope="singleton">
					<injectedProperties>
						
						<datetime name="Property1" value="1915-04-24 00:00:00.001" />
						<double name="Property2" value="365.41" />
						<injectedObject name="Property3" type="SharedServices.Interfaces.IInterface3" />
					</injectedProperties>
				</implementation>

				
				<implementation type="SharedServices.Implementations.Interface2_Impl3"
								scope="singleton">
					<parameters>
						
						<datetime name="param1" value="2017-10-29 23:59:59.099" />
						<double name="param2" value="138.3" />

						
						<injectedObject name="param3" type="SharedServices.Implementations.Interface3_Impl2" />
					</parameters>
					<injectedProperties>
						<double name="Property2" value="148.3" />
						
						<injectedObject name="Property3" type="SharedServices.Implementations.Interface3_Impl3" />
					</injectedProperties>
				</implementation>

				
				<implementation type="SharedServices.Implementations.Interface2_Impl4"
								scope="singleton">
				</implementation>
			</service>

			
			<service type="SharedServices.Interfaces.Airplane.IAirplane" >
				<implementation type="SharedServices.Implementations.Airplane.Airplane" scope="singleton" >
					<parameters>
						
						<constructedValue name="engine" type="SharedServices.Implementations.Airplane.AirplaneEngine">
							<parameters>
								
								<injectedObject name="blade" type="SharedServices.Interfaces.Airplane.IAirplaneEngineBlade" />
								<injectedObject name="rotor" type="SharedServices.Interfaces.Airplane.IAirplaneEngineRotor" />
							</parameters>
							
							
						</constructedValue>

					</parameters>
				</implementation>

				
				<implementation type="SharedServices.Implementations.Airplane.Airplane" scope="singleton">

					<injectedProperties>
						
						<constructedValue name="Engine" type="SharedServices.Implementations.Airplane.AirplaneEngine">
							


							
							<injectedProperties>

								
								<injectedObject name="Blade" type="SharedServices.Interfaces.Airplane.IAirplaneEngineBlade" />
								<injectedObject name="Rotor" type="SharedServices.Interfaces.Airplane.IAirplaneEngineRotor" />
							</injectedProperties>
						</constructedValue>
					</injectedProperties>
				</implementation>
			</service>

			<service type="SharedServices.Interfaces.Airplane.IAirplaneEngineBlade">
				<implementation  type="SharedServices.Implementations.Airplane.AirplaneEngineBlade" scope="singleton"></implementation>
			</service>
			<service type="SharedServices.Interfaces.Airplane.IAirplaneEngineRotor">
				<implementation  type="SharedServices.Implementations.Airplane.AirplaneEngineRotor" scope="singleton"></implementation>
			</service>

			

			<selfBoundService type="DynamicallyLoadedAssembly1.Implementations.CleanupJob2"
							  scope="transient">
				<parameters>
					<injectedObject name="cleanupJobData"
									type="DynamicallyLoadedAssembly1.Implementations.CleanupJobData2" />
				</parameters>
			</selfBoundService>

			<selfBoundService type="DynamicallyLoadedAssembly1.Implementations.CleanupJob3"
							  scope="singleton">
				<injectedProperties>
					<injectedObject name="CleanupJobData"
									type="DynamicallyLoadedAssembly1.Implementations.CleanupJobData2"/>
				</injectedProperties>
			</selfBoundService>

			<service type="SharedServices.Interfaces.ICleanupJobData">
				<implementation type="DynamicallyLoadedAssembly1.Implementations.CleanupJobData"
								scope="singleton">
				</implementation>

			</service>

			
			<service type="SharedServices.Interfaces.IInterface5">
				<implementation type="SharedServices.Implementations.Interface5_Impl1"
								scope="singleton" />
				<implementation type="TestPluginAssembly1.Implementations.Interface5_Plugin1Impl"
								scope="singleton" />
				<implementation type="TestPluginAssembly2.Implementations.Interface5_Plugin2Impl"
								scope="transient" />
				<implementation type="TestPluginAssembly3.Implementations.Interface5_Plugin3Impl"
								scope="transient" />
			</service>

			
			<service type="SharedServices.Interfaces.IInterface6"
					 registerIfNotRegistered="true">
				<implementation type="SharedServices.Implementations.Interface6_Impl2"
								scope="singleton" />
			</service>

			
			<service type="SharedServices.Interfaces.IInterface7"
					 registerIfNotRegistered="true">
				<implementation type="SharedServices.Implementations.Interface7_Impl1"
								scope="singleton" />
			</service>

			<selfBoundService type="SharedServices.Implementations.SelfBoundService1"
							  registerIfNotRegistered="true" scope="singleton">

			</selfBoundService>

			<service type="SharedServices.Interfaces.IInterface12">
				<implementation type="SharedServices.Implementations.Interface12_Impl1" scope="singleton">
					<parameters>
						
						
						<settingValue name="param1" settingName="Interface11_Value"/>
					</parameters>
					<injectedProperties>
						
						<settingValue name="Property2" settingName="Interface11_Value"/>
					</injectedProperties>
				</implementation>

			</service>
			<service type="SharedServices.Interfaces.IDbConnection">
				<valueImplementation scope="singleton">
					<settingValue settingName="DefaultDBConnection"/>
				</valueImplementation>
			</service>

			
			
			<service type="System.Collections.Generic.IReadOnlyList[SharedServices.Interfaces.IDbConnection]">
				<valueImplementation scope="singleton">
					<collection>
						<settingValue settingName="DefaultDBConnection"/>
						<constructedValue type="SharedServices.Implementations.SqlServerDbConnection">
							<parameters>
								<string name="serverName" value="SQLSERVER2012"/>
								<string name="databaseName" value="DB1"/>
								<string name="userName" value="user1"/>
								<string name="password" value="password123"/>
							</parameters>
						</constructedValue>
						<constructedValue type="SharedServices.Implementations.SqlServerDbConnection">
							<parameters>
								<string name="serverName" value="SQLSERVER2016"/>
								<string name="databaseName" value="DB1"/>
								<string name="userName" value="user1"/>
								<string name="password" value="password123"/>
							</parameters>
						</constructedValue>
					</collection>
				</valueImplementation>
			</service>

			
			
			<proxyService type="IoC.Configuration.Tests.AutoService.Services.IActionValidatorFactoryBase">
				<serviceToProxy type="IoC.Configuration.Tests.AutoService.Services.IActionValidatorFactory"/>
			</proxyService>

			
			<selfBoundService type="SharedServices.Implementations.Interface13_Impl1" scope="singleton" />

			
			<proxyService type="SharedServices.Interfaces.IInterface13">
				<serviceToProxy type="SharedServices.Implementations.Interface13_Impl1"/>
			</proxyService>

			<service type="SharedServices.Interfaces.IInterface14">
				<implementation type="SharedServices.Implementations.Interface14_Impl1" scope="singleton" />
			</service>

			

			
			<selfBoundService type="IoC.Configuration.Tests.ProxyService.Services.ActionValidatorsUser" scope="singleton">
			</selfBoundService>

			
			<service typeRef="ListOfInt">
				<valueImplementation scope="singleton">
					<collection>
						<int32 value="19"/>
						<int32 value="2"/>
						<int32 value="17"/>
					</collection>
				</valueImplementation>
			</service>

			
			<proxyService type="System.Collections.Generic.IEnumerable[System.Int32]">
				<serviceToProxy typeRef="ListOfInt"/>
			</proxyService>

			
			<proxyService type="System.Collections.Generic.IReadOnlyList[System.Int32]">
				<serviceToProxy typeRef="ListOfInt"/>
			</proxyService>

			
			<proxyService type="System.Collections.Generic.IList[System.Int32]">
				<serviceToProxy typeRef="ListOfInt"/>
			</proxyService>

			
			<service type="System.Collections.Generic.IReadOnlyList[IoC.Configuration.Tests.ClassMember.Services.IAppInfo]">
				<valueImplementation scope="singleton">
					<collection>
						<constructedValue type="IoC.Configuration.Tests.ClassMember.Services.AppInfo">
							<parameters>
								
								<classMember name="appId"
											 class="IoC.Configuration.Tests.ClassMember.Services.ConstAndStaticAppIds"
											 memberName="AppId1"/>
							</parameters>
						</constructedValue>
						<constructedValue type="IoC.Configuration.Tests.ClassMember.Services.AppInfo">
							<injectedProperties>
								
								<classMember name="AppId"  class="SharedServices.Implementations.SelfBoundService1"
											 memberName="IntValue"/>
							</injectedProperties>
						</constructedValue>

						<constructedValue type="IoC.Configuration.Tests.ClassMember.Services.AppInfo">
							<parameters>
								
								<classMember name="appId"
											 class="IoC.Configuration.Tests.ClassMember.Services.AppTypes"
											 memberName="App1"/>
							</parameters>
						</constructedValue>

						
						<classMember class="IoC.Configuration.Tests.ClassMember.Services.IAppInfoFactory" memberName="CreateAppInfo">
							<parameters>
								<int32 name="appId" value="1258"/>
								<string name="appDescription" value="App info created with non-static method call."/>
							</parameters>
						</classMember>

						
						<classMember class="IoC.Configuration.Tests.ClassMember.Services.StaticAppInfoFactory" memberName="CreateAppInfo">
							<parameters>
								<int32 name="appId" value="1259"/>
								<string name="appDescription" value="App info created with static method call."/>
							</parameters>
						</classMember>
					</collection>
				</valueImplementation>
			</service>

			<service type="IoC.Configuration.Tests.ClassMember.Services.IAppInfoFactory">
				<implementation type="IoC.Configuration.Tests.ClassMember.Services.AppInfoFactory" scope="singleton"/>
			</service>

			
		</services>

		<autoGeneratedServices>
			

			
			<autoService interfaceRef="IProjectGuids" >

				
				<autoProperty name="Project1" returnTypeRef="Guid">
					<object typeRef="Guid" value="966FE6A6-76AC-4895-84B2-47E27E58FD02"/>
				</autoProperty>

				<autoProperty name="Project2" returnTypeRef="Guid">
					<object typeRef="Guid" value="AC4EE351-CE69-4F89-A362-F833489FD9A1"/>
				</autoProperty>

				<autoMethod name="GetDefaultProject" returnTypeRef="Guid">
					
					<default>
						
						<object typeRef="Guid" value="1E08071B-D02C-4830-AE3C-C9E78A29EA37"/>

					</default>
				</autoMethod>

			
			</autoService>

			
			<autoService interface="IoC.Configuration.Tests.AutoService.Services.IAppInfoFactory">
				<autoMethod name="CreateAppInfo" returnType="IoC.Configuration.Tests.AutoService.Services.IAppInfo">
					<methodSignature>
						<int32 paramName="appId"/>
						<string paramName="appDescription"/>
					</methodSignature>

					<default>
						<constructedValue type="IoC.Configuration.Tests.AutoService.Services.AppInfo">
							<parameters>
								
								
								
								<parameterValue name="appId" paramName="appId" />
								<parameterValue name="appDescription" paramName="appDescription" />
							</parameters>
						</constructedValue>
					</default>
				</autoMethod>
			</autoService>

			
			<autoService interface="IoC.Configuration.Tests.AutoService.Services.IActionValidatorFactory">

				<autoProperty name="DefaultActionValidator" returnType="SharedServices.Interfaces.IActionValidator">
					<injectedObject type="IoC.Configuration.Tests.AutoService.Services.ActionValidatorDefault"/>
				</autoProperty>

				<autoProperty name="PublicProjectId" returnType="System.Guid" >
					<object type="System.Guid" value="95E352DD-5C79-49D0-BD51-D62153570B61"/>
				</autoProperty>

				<autoMethod name="GetValidators"
							returnType="System.Collections.Generic.IReadOnlyList[SharedServices.Interfaces.IActionValidator]"
							reuseValue="true">

					<methodSignature>
						
						<object paramName="actionType" typeRef="ActionTypes"/>
						<object paramName="projectGuid" type="System.Guid"/>
					</methodSignature>

					
					
					<if parameter1="_classMember:ActionTypes.ViewFilesList" parameter2="8663708F-C707-47E1-AEDC-2CD9291AD4CB">
						<collection>
							<constructedValue type="SharedServices.Implementations.ActionValidator3">
								<parameters>
									<int32 name="intParam" value="7"/>
								</parameters>
							</constructedValue>

							
							<injectedObject type="IoC.Configuration.Tests.AutoService.Services.ActionValidatorWithDependencyOnActionValidatorFactory"/>

							<constructedValue type=" IoC.Configuration.Tests.AutoService.Services.ActionValidator1" >
								<parameters>
									<injectedObject name="param1" typeRef="AutoService_IInterface1" />
								</parameters>
								<injectedProperties>
									
									<injectedObject name="Property2" type="IoC.Configuration.Tests.AutoService.Services.IInterface2" />
								</injectedProperties>
							</constructedValue>

							<injectedObject type="TestPluginAssembly1.Implementations.Plugin1ActionValidator"/>

							<classMember class="IoC.Configuration.Tests.AutoService.Services.StaticAndConstMembers" memberName="ActionValidator1" />

							
							<classMember class="IoC.Configuration.Tests.AutoService.Services.IActionValidatorValuesProvider"
										 memberName="DefaultActionValidator"/>

							
							<injectedObject type="TestPluginAssembly3.Implementations.Plugin3ActionValidator"/>
						</collection>
					</if>

					
					
					<if parameter1="_classMember:ActionTypes.ViewFileContents" parameter2="_settings:Project1Guid">
						<collection>
							

							<injectedObject type="IoC.Configuration.Tests.AutoService.Services.ActionValidator1" />

							
							<classMember class="IoC.Configuration.Tests.AutoService.Services.IActionValidatorValuesProvider"
										 memberName="GetViewOnlyActionvalidator"/>
						</collection>
					</if>

					
					
					<if parameter1="_classMember:IoC.Configuration.Tests.AutoService.Services.StaticAndConstMembers.DefaultActionType"
						parameter2="_classMember:IProjectGuids.Project1">
						<collection>
							
						</collection>
					</if>

					
					
					<if parameter1="_classMember:ActionTypes.ViewFileContents"
						parameter2="_classMember:IoC.Configuration.Tests.AutoService.Services.StaticAndConstMembers.GetDefaultProjectGuid">

						
						<collection>
							

							<injectedObject type="SharedServices.Implementations.ActionValidator2" />
							<injectedObject type="IoC.Configuration.Tests.AutoService.Services.ActionValidator1" />
						</collection>
					</if>

					
					<if parameter1="_classMember:ActionTypes.ViewFilesList"
						parameter2="_classMember:IoC.Configuration.Tests.AutoService.Services.IActionValidatorFactory.PublicProjectId">
						<collection>
							
							<classMember class="IoC.Configuration.Tests.AutoService.Services.IActionValidatorFactory" memberName="DefaultActionValidator"/>
						</collection>

					</if>

					
					<default>
						<collection>
							
							<classMember class="IoC.Configuration.Tests.AutoService.Services.IActionValidatorFactory" memberName="DefaultActionValidator"/>
							<injectedObject type="SharedServices.Implementations.ActionValidator3" />
							<injectedObject type="DynamicallyLoadedAssembly2.ActionValidator4"/>
						</collection>
					</default>
				</autoMethod>

				
				<autoMethod name="GetValidators"
							returnType="System.Collections.Generic.IReadOnlyList[SharedServices.Interfaces.IActionValidator]">
					<methodSignature>
						
						<int32 paramName="actionTypeId"/>
						<string paramName="projectGuid" />
					</methodSignature>

					
					<if parameter1="0" parameter2="8663708F-C707-47E1-AEDC-2CD9291AD4CB">
						<collection>
							<injectedObject type="SharedServices.Implementations.ActionValidator3" />
							<injectedObject type="IoC.Configuration.Tests.AutoService.Services.ActionValidator4" />
						</collection>
					</if>

					<default>
						<collection>
							
							<classMember class="IoC.Configuration.Tests.AutoService.Services.IActionValidatorFactory"
										 memberName="DefaultActionValidator"/>
							<injectedObject type="SharedServices.Implementations.ActionValidator3" />
							<classMember class="IoC.Configuration.Tests.AutoService.Services.StaticAndConstMembers"
										 memberName="GetDefaultActionValidator" />
							<classMember class="IoC.Configuration.Tests.AutoService.Services.IActionValidatorValuesProvider"
										 memberName="AdminLevelActionValidator"/>
						</collection>
					</default>
				</autoMethod>

			
			</autoService>

			
			<autoService interface="IoC.Configuration.Tests.AutoService.Services.IMemberAmbiguityDemo">
				
				<autoMethod name="GetIntValues" returnType="System.Collections.Generic.IReadOnlyList[System.Int32]" >
					<methodSignature>
						<int32 paramName="param1"/>
						<string paramName="param2"/>
					</methodSignature>
					<if parameter1="1" parameter2="str1">
						<collection>
							<int32 value="17"/>
						</collection>
					</if>
					<default>
						<collection>
							<int32 value="18"/>
							<int32 value="19"/>
						</collection>
					</default>
				</autoMethod>

				
				<autoMethod name="GetIntValues" returnType="System.Collections.Generic.IReadOnlyList[System.Int32]"
							declaringInterface="IoC.Configuration.Tests.AutoService.Services.IMemberAmbiguityDemo_Parent3">
					<methodSignature>
						<int32 paramName="param1"/>
						<string paramName="param2"/>
					</methodSignature>
					<default>
						<collection>
							<int32 value="3"/>
						</collection>
					</default>
				</autoMethod>

				
				<autoMethod name="GetDbConnection" returnType="SharedServices.Interfaces.IDbConnection"
							declaringInterface="IoC.Configuration.Tests.AutoService.Services.IMemberAmbiguityDemo_Parent2">
					<methodSignature>
						<object paramName="appGuid" type="System.Guid"/>
					</methodSignature>
					<default>
						<constructedValue type="SharedServices.Implementations.SqliteDbConnection">
							<parameters>
								<string name="filePath" value="c:\mySqliteDatabase.sqlite"/>
							</parameters>
						</constructedValue>
					</default>
				</autoMethod>

				
				
				<autoProperty name="DefaultDbConnection" returnType="SharedServices.Interfaces.IDbConnection"
							  declaringInterface="IoC.Configuration.Tests.AutoService.Services.IMemberAmbiguityDemo_Parent1">
					<constructedValue type="SharedServices.Implementations.SqliteDbConnection">
						<parameters>
							<string name="filePath" value="c:\IMemberAmbiguityDemo_Parent1_Db.sqlite"/>
						</parameters>
					</constructedValue>
				</autoProperty>

				
				<autoProperty name="DefaultDbConnection" returnType="SharedServices.Interfaces.IDbConnection"
							  declaringInterface="IoC.Configuration.Tests.AutoService.Services.IMemberAmbiguityDemo_Parent2">
					<constructedValue type="SharedServices.Implementations.SqliteDbConnection">
						<parameters>
							<string name="filePath" value="c:\IMemberAmbiguityDemo_Parent2_Db.sqlite"/>
						</parameters>
					</constructedValue>
				</autoProperty>

				
				
				<autoMethod name="GetNumericValue" returnType="System.Double" >
					<default>
						<double value="17.3"/>
					</default>
				</autoMethod>

				
				<autoMethod name="GetNumericValue" returnType="System.Int32" >
					<default>
						<int32 value="19"/>
					</default>
				</autoMethod>

				
				
				<autoProperty name="NumericValue" returnType="System.Double" >
					<double value="18.2"/>
				</autoProperty>

				
				<autoProperty name="NumericValue" returnType="System.Int32" >
					<int32 value="14"/>
				</autoProperty>

				
				<autoMethod name="MethodWithOptionalParameters" returnType="System.Int32">
					<methodSignature>
						<int32 paramName="param1"/>
						<double paramName="param2"/>
						<int32 paramName="param3"/>
					</methodSignature>
					<if parameter1="3" parameter2="3.5" parameter3="7">
						<int32 value="17"/>
					</if>
					<default>
						<int32 value="18"/>
					</default>
				</autoMethod>
			</autoService>

			
			<autoServiceCustom interface="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.DataRepositories.IAuthorsRepository">
				<autoServiceCodeGenerator>
					<constructedValue type="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.RepositoryInterfaceImplementationGenerator">
						<parameters>
							<int32 name="someDemoConstructorParameter" value="15" />
						</parameters>
					</constructedValue>
				</autoServiceCodeGenerator>
			</autoServiceCustom>

			<autoServiceCustom interface="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.DataRepositories.IBooksRepository">
				<autoServiceCodeGenerator>
					<constructedValue type="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.RepositoryInterfaceImplementationGenerator">
						<parameters>
							<int32 name="someDemoConstructorParameter" value="25" />
						</parameters>
					</constructedValue>
				</autoServiceCodeGenerator>
			</autoServiceCustom>

			<autoServiceCustom interface="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.DataRepositories.IAuthorBooksRepository">
				<autoServiceCodeGenerator>
					<constructedValue type="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.RepositoryInterfaceImplementationGenerator">
						<parameters>
							<int32 name="someDemoConstructorParameter" value="35" />
						</parameters>
					</constructedValue>
				</autoServiceCodeGenerator>
			</autoServiceCustom>
		</autoGeneratedServices>
	</dependencyInjection>

	<startupActions>
		<startupAction type="DynamicallyLoadedAssembly1.Implementations.StartupAction1">
			
			
			
			
		</startupAction>
		<startupAction type="DynamicallyLoadedAssembly1.Implementations.StartupAction2">
		</startupAction>
	</startupActions>

	<pluginsSetup>
		<pluginSetup plugin="Plugin1">
			
			<pluginImplementation type="TestPluginAssembly1.Implementations.Plugin1">
				<parameters>
					<int64 name="param1" value="25" />
				</parameters>
				<injectedProperties>
					<int64 name="Property2" value="35"/>
				</injectedProperties>
			</pluginImplementation>
			<settings>
				<int32 name="Int32Setting1" value="25" />
				<int64 name="Int64Setting1" value="38" />
				<string name="StringSetting1" value="String Value 1" />
			</settings>

			<webApi>
				<controllerAssemblies>
					
					<controllerAssembly assembly="pluginassm1" />
					<controllerAssembly assembly="plugin1api" />
				</controllerAssemblies>
			</webApi>
			<dependencyInjection>
				<modules>
					<module type="ModulesForPlugin1.Ninject.NinjectModule1">
						<parameters>
							<int32 name="param1" value="101" />
						</parameters>
					</module>

					<module type="ModulesForPlugin1.Autofac.AutofacModule1" >
						<parameters>
							<int32 name="param1" value="102" />
						</parameters>
					</module>

					<module type="ModulesForPlugin1.IoC.DiModule1" >
						<parameters>
							<int32 name="param1" value="103" />
						</parameters>
					</module>
				</modules>
				<services>
					<service type="TestPluginAssembly1.Interfaces.IDoor">
						<implementation type="TestPluginAssembly1.Implementations.Door"
										scope="transient">
							<parameters>
								<int32 name="Color" value="3" />
								<double name="Height" value="180" />
							</parameters>
						</implementation>
					</service>
					<service type="TestPluginAssembly1.Interfaces.IRoom">
						<implementation type="TestPluginAssembly1.Implementations.Room"
										scope="transient">
							<parameters>
								<object name="door1" type="TestPluginAssembly1.Interfaces.IDoor"
										value="5,185.1" />
								<injectedObject name="door2" type="TestPluginAssembly1.Interfaces.IDoor" />
							</parameters>
							<injectedProperties>
								<object name="Door2" type="TestPluginAssembly1.Interfaces.IDoor"
										value="7,187.3" />
							</injectedProperties>
						</implementation>
					</service>
				</services>
				<autoGeneratedServices>
					
					<autoService interface="TestPluginAssembly1.Interfaces.IResourceAccessValidatorFactory">
						<autoMethod name="GetValidators"
									returnType="System.Collections.Generic.IEnumerable[TestPluginAssembly1.Interfaces.IResourceAccessValidator]"
									reuseValue="true" >
							<methodSignature>
								<string paramName="resourceName"/>
							</methodSignature>
							<if parameter1="public_pages">
								<collection>
									<injectedObject type="TestPluginAssembly1.Interfaces.ResourceAccessValidator1"/>
								</collection>

							</if>
							<if parameter1="admin_pages">
								<collection>
									<injectedObject type="TestPluginAssembly1.Interfaces.ResourceAccessValidator1"/>
									<injectedObject type="TestPluginAssembly1.Interfaces.ResourceAccessValidator2"/>
								</collection>
							</if>
							<default>
								<collection>
									<injectedObject type="TestPluginAssembly1.Interfaces.ResourceAccessValidator2"/>
									<injectedObject type="TestPluginAssembly1.Interfaces.ResourceAccessValidator1"/>
								</collection>
							</default>
						</autoMethod>
					</autoService>
				</autoGeneratedServices>
			</dependencyInjection>
		</pluginSetup>

		<pluginSetup plugin="Plugin2">
			<pluginImplementation type="TestPluginAssembly2.Implementations.Plugin2">
				<parameters>
					<boolean name="param1" value="true" />
					<double name="param2" value="25.3" />
					<string name="param3" value="String value" />
				</parameters>
				<injectedProperties>
					<double name="Property2" value="5.3" />
				</injectedProperties>
			</pluginImplementation>
			<settings>
			</settings>

			<dependencyInjection>
				<modules>
				</modules>
				<services>
					<service type="TestPluginAssembly2.Interfaces.IWheel">
						<implementation type="TestPluginAssembly2.Implementations.Wheel"
										scope="transient">
							<parameters>
								<int32 name="Color" value="5" />
								<double name="Height" value="48" />
							</parameters>
						</implementation>
					</service>
					<service type="TestPluginAssembly2.Interfaces.ICar">
						<implementation type="TestPluginAssembly2.Implementations.Car"
										scope="transient">
							<parameters>
								<object name="wheel1" type="TestPluginAssembly2.Interfaces.IWheel" value="248,40" />
							</parameters>
							<injectedProperties>
								<object name="Wheel1" type="TestPluginAssembly2.Interfaces.IWheel" value="27,45" />
								<injectedObject name="Wheel2" type="TestPluginAssembly2.Interfaces.IWheel"/>
							</injectedProperties>
						</implementation>
					</service>
				</services>
				<autoGeneratedServices>

				</autoGeneratedServices>
			</dependencyInjection>
		</pluginSetup>

		<pluginSetup plugin="Plugin3">
			<pluginImplementation type="TestPluginAssembly3.Implementations.Plugin3">
			</pluginImplementation>
			<settings></settings>
			<webApi>
				<controllerAssemblies>
					
					<controllerAssembly assembly="pluginassm3" />
				</controllerAssemblies>
			</webApi>
			<dependencyInjection>
				<modules>
				</modules>
				<services>
				</services>
				<autoGeneratedServices>
				</autoGeneratedServices>
			</dependencyInjection>
		</pluginSetup>
	</pluginsSetup>
</iocConfiguration>


Code Based Configuration

Code based configuration is pretty similar to file based configuration, except there is no configuration file. All dependencies are bound in IoC.Configuration modules (i.e., instances IoC.Configuration.DiContainer.IDiModule) native modules (e.g., instances of Autofac.AutofacModule or Ninject.Modules.NinjectModule)

Here is an example of code based configuration.


TestsSharedLibrary.TestsHelper.SetupLogger();

// Probing paths are used to re-solve the dependencies.
var assemblyProbingPaths = new string[]
{
    DiManagerHelpers.ThirdPartyLibsFolder,
    DiManagerHelpers.DynamicallyLoadedDllsFolder,
    DiManagerHelpers.GetDiImplementationInfo(DiImplementationType.Autofac).DiManagerFolder
};

var diImplementationInfo = DiManagerHelpers.GetDiImplementationInfo(DiImplementationType.Autofac);

using (var containerInfo = 
        new DiContainerBuilder.DiContainerBuilder()
                .StartCodeBasedDi("IoC.Configuration.Autofac.AutofacDiManager",
                                  diImplementationInfo.DiManagerAssemblyPath,
                                  new ParameterInfo[0],
                                  Helpers.TestsEntryAssemblyFolder,
                                  assemblyProbingPaths)
                .WithoutPresetDiContainer()
                // Note, AddNativeModule() to add native modules (e.g., instances of  Autofac.AutofacModule or
                // Ninject.Modules.NinjectModule) // and AddDiModules to add IoC.Configuration modules (i.e.,
                // instances IoC.Configuration.DiContainer.IDiModule), can be called multiple times, without
                // any restriction on the order in which these methods are called.           
                .AddNativeModule("Modules.Autofac.AutofacModule1",
                                 Path.Combine(DiManagerHelpers.DynamicallyLoadedDllsFolder, "TestProjects.Modules.dll"), 
                                 new[] { new ParameterInfo(typeof(int), 18) })
                .AddDiModules(new TestDiModule())
                .RegisterModules()
                .Start())
{
    var container = containerInfo.DiContainer;
    Assert.IsNotNull(containerInfo.DiContainer.Resolve<IInterface6>());
}

Native and IoC.Configuration modules in configuration file.

Both native modules (e.g., subclasses of Autofac.AutofacModule or Ninject.Modules.NinjectModule) and IoC.Configuration modules can be specified in configuration files.

Here is an example from configuration file above which has both native and container agnostic IoC.Configuration modules.

	
	<dependencyInjection>
		<modules>
			
			<module type="Modules.IoC.DiModule1" >
				<parameters>
					<int32 name="param1" value="2" />
				</parameters>
			</module>

			
			<module type="Modules.Autofac.AutofacModule1" >
				<parameters>
					<int32 name="param1" value="1" />
				</parameters>
			</module>

			
			<module type="Modules.Ninject.NinjectModule1" >
				<parameters>
					<int32 name="param1" value="3" />
				</parameters>
			</module>
		</modules>
	</dependencyInjection>

alternate text is missing from this package README image

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on IoC.Configuration:

Package Downloads
IoC.Configuration.Autofac

An Autofac extension for IoC.Configuration. Detailed documentation on IoC.Configuration is available at http://iocconfiguration.readthedocs.io Look at http://iocconfiguration.readthedocs.io/

IoC.Configuration.Ninject

A Ninject extension for IoC.Configuration. Source code can be found at https://github.com/artakhak/IoC.Configuration Detailed documentation on IoC.Configuration is available at http://iocconfiguration.readthedocs.io Look at http://iocconfiguration.readthedocs.io/

IoC.Configuration.Extensions

An extension for IoC.Configuration library at https://www.nuget.org/packages/IoC.Configuration/. Detailed documentation on IoC.Configuration is available at http://iocconfiguration.readthedocs.io.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.1 140 5/4/2025
2.2.0 138 5/4/2025
2.1.0 1,447 4/10/2022
2.0.2 1,003 3/17/2019
2.0.1 924 3/17/2019
2.0.0 1,560 2/27/2019
1.0.6 1,409 6/12/2018
1.0.5 1,366 6/11/2018
1.0.4 1,366 6/5/2018
1.0.3 2,576 5/9/2018
1.0.2 1,397 5/9/2018
1.0.1 1,997 4/18/2018
1.0.0 1,501 4/18/2018
1.0.0-beta4 1,170 4/4/2018
1.0.0-beta3 1,169 4/2/2018
1.0.0-beta2 1,555 4/1/2018
1.0.0-beta 1,030 4/1/2018

Small fix to README.md