/// <summary>
 ///     Creates an instance of <see cref="IFileBasedDiContainerConfigurator" /> for file based dependency injection
 ///     configuration.
 /// </summary>
 /// <param name="configurationFileContentsProvider">
 ///     The configuration file contents provider.
 ///     An example implementation of <see cref="IConfigurationFileContentsProvider" /> implementation is
 ///     <see cref="FileBasedConfigurationFileContentsProvider" />
 /// </param>
 /// <param name="entryAssemblyFolder">The entry assembly folder.</param>
 /// <param name="loadedConfiguration">
 ///     Output parameter that returns an instance of
 ///     <see cref="ConfigurationFile.IConfiguration" />.
 /// </param>
 /// <param name="configurationFileXmlDocumentLoaded">The configuration file XML document loaded.</param>
 /// <exception cref="ConfigurationParseException">Throws this exception if configuration parse/load fails.</exception>
 /// <exception cref="LoggerWasNotInitializedException"></exception>
 /// <exception cref="OROptimizer.DynamicCode.DynamicCodeGenerationException">Throws this exception if dynamic code generation fails.</exception>
 /// <exception cref="Exception">Throws this exception.</exception>
 public IFileBasedDiContainerConfigurator StartFileBasedDi([NotNull] IConfigurationFileContentsProvider configurationFileContentsProvider,
                                                           [NotNull] string entryAssemblyFolder,
                                                           out IConfiguration loadedConfiguration,
                                                           [CanBeNull] ConfigurationFileXmlDocumentLoadedEventHandler configurationFileXmlDocumentLoaded = null)
 {
     return(StartFileBasedDi(configurationFileContentsProvider, entryAssemblyFolder, new AllLoadedAssemblies(), out loadedConfiguration,
                             configurationFileXmlDocumentLoaded));
 }
 /// <summary>
 ///     Creates an instance of <see cref="IFileBasedDiContainerConfigurator" /> for file based dependency injection
 ///     configuration.
 /// </summary>
 /// <param name="configurationFileContentsProvider">
 ///     The configuration file contents provider.
 ///     An example implementation of <see cref="IConfigurationFileContentsProvider" /> implementation is
 ///     <see cref="FileBasedConfigurationFileContentsProvider" />
 /// </param>
 /// <param name="entryAssemblyFolder">The entry assembly folder.</param>
 /// <param name="loadedAssemblies"> Instance of <see cref="ILoadedAssemblies"/> used to add add all or some of currently
 ///                     loaded assemblies as dependencies for  dynamically generated assemblies.
 ///                     Use an instance of <see cref="AllLoadedAssemblies"/> to add references to all assemblies loaded into current application
 ///                     domain to the dynamically generated assembly. Use <see cref="NoLoadedAssemblies"/> to not add any additional assemblies
 ///                     references to any additional assemblies as dependencies for  dynamically generated assemblies.
 ///                     Provide your own implementation to add only some of loaded assemblies as dependencies.
 /// </param>
 /// <param name="loadedConfiguration">
 ///     Output parameter that returns an instance of
 ///     <see cref="ConfigurationFile.IConfiguration" />.
 /// </param>
 /// <param name="configurationFileXmlDocumentLoaded">The configuration file XML document loaded.</param>
 /// <exception cref="ConfigurationParseException">Throws this exception if configuration parse/load fails.</exception>
 /// <exception cref="LoggerWasNotInitializedException"></exception>
 /// <exception cref="OROptimizer.DynamicCode.DynamicCodeGenerationException">Throws this exception if dynamic code generation fails.</exception>
 /// <exception cref="Exception">Throws this exception.</exception>
 public IFileBasedDiContainerConfigurator StartFileBasedDi([NotNull] IConfigurationFileContentsProvider configurationFileContentsProvider,
                                                           [NotNull] string entryAssemblyFolder,
                                                           [NotNull] ILoadedAssemblies loadedAssemblies,
                                                           out IConfiguration loadedConfiguration,
                                                           [CanBeNull] ConfigurationFileXmlDocumentLoadedEventHandler configurationFileXmlDocumentLoaded = null)
 {
     return(StartFileBasedDi(new FileBasedConfigurationParameters(configurationFileContentsProvider, entryAssemblyFolder, loadedAssemblies)
     {
         ConfigurationFileXmlDocumentLoaded = configurationFileXmlDocumentLoaded
     }, out loadedConfiguration));
 }
        private void LoadConfiguration(Action <IContainerInfo, IConfiguration> testConfiguration,
                                       ConfigurationFileXmlDocumentLoadedEventHandler configurationFileXmlDocumentLoaded)
        {
            var diContainerBuilder = new DiContainerBuilder.DiContainerBuilder();

            var fileBasedConfigurationParameters = new FileBasedConfigurationParameters(new FileBasedConfigurationFileContentsProvider(
                                                                                            Path.Combine(Helpers.TestsEntryAssemblyFolder, "IoCConfiguration_Overview.xml")),
                                                                                        Helpers.TestsEntryAssemblyFolder, new LoadedAssembliesForTests())
            {
                AttributeValueTransformers         = new [] { new FileFolderPathAttributeValueTransformer() },
                ConfigurationFileXmlDocumentLoaded = configurationFileXmlDocumentLoaded
            };

            using (var containerInfo = diContainerBuilder.StartFileBasedDi(
                       fileBasedConfigurationParameters, out var loadedConfiguration)
                                       .WithoutPresetDiContainer()
                                       //.AddAdditionalDiModules(new SuccessfulConfigurationLoadTests.SuccessfulConfigurationLoadTests.TestModule2())
                                       .RegisterModules()
                                       .Start())
            {
                testConfiguration(containerInfo, loadedConfiguration);
            }
        }