Skip to content

Latest commit

 

History

History
197 lines (162 loc) · 8.85 KB

IoCConfiguration_autoServiceCustom.generated.rst

File metadata and controls

197 lines (162 loc) · 8.85 KB

IoCConfiguration_autoServiceCustom.xml

This configuration file can be downloaded downloaded from IoCConfiguration_autoServiceCustom.xml.

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

<!--
   The XML configuration file is validated against schema file IoC.Configuration.Schema.7579ADB2-0FBD-4210-A8CA-EE4B4646DB3F.xsd, 
   which can be found in folder IoC.Configuration.Content in output directory. 
   The schema file can also be downloaded from 
   http://oroptimizer.com/ioc.configuration/V2/IoC.Configuration.Schema.7579ADB2-0FBD-4210-A8CA-EE4B4646DB3F.xsd or in source code 
   project in Github.com.

   To use Visual Studio code completion based on schema contents, right click Properties on this file in Visual Studio, and in Schemas 
   field pick the schema IoC.Configuration.Schema.7579ADB2-0FBD-4210-A8CA-EE4B4646DB3F.xsd.

   Before running the tests make sure to execute IoC.Configuration\Tests\IoC.Configuration.Tests\PostBuildCommands.bat to copy the dlls into 
   folders specified in this configuration file.
   Also, modify the batch file to copy the Autofac and Ninject assemblies from Nuget packages folder on machine, where the test is run.
-->

<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">

    <!--The application should have write permissions to path specified in appDataDir. 
    This is where dynamically generated DLLs are saved.-->
    <!--NOTE: path should be an absolute path, or should be converted to absolute path by some implementation of 
    IoC.Configuration.AttributeValueTransformer.IAttributeValueTransformer. In this example the paths are converted by 
    IoC.Configuration.Tests.FileFolderPathAttributeValueTransformer.-->
    <appDataDir 
        path="TestFiles\AutogeneratedDlls\DynamicFiles_AutoServiceCustomTests"  />

    <plugins pluginsDirPath="TestFiles\PluginDlls">

        <!--        
        Plugin assemblies will be in a folder with similar name under pluginsDirPath folder.
        The plugin folders will be included in assembly resolution mechanism.        
        -->

        <!--A folder K:\...\IoC.Configuration\Tests\IoC.Configuration.Tests\bin\TestFiles\PluginDlls\Plugin1 should exist.  -->
    </plugins>

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

    <assemblies>
        <!--Assemblies should be in one of the following locations:
        1) Executable's folder
        2) In folder specified in additionalAssemblyProbingPaths element.
        3) In one of the plugin folders specified in plugins element (only for assemblies with plugin attribute) -->

        <!--
        Use "overrideDirectory" attribute, to make the assembly path explicit, rather then searching for
        an assembly in predefined folders, which also include probing paths specified in additionalAssemblyProbingPaths element.
        -->
        <assembly name="IoC.Configuration.Autofac" alias="autofac_ext" />
        <assembly name="IoC.Configuration.Ninject" alias="ninject_ext" />

        <assembly name="TestProjects.SharedServices" alias="shared_services" />
        <assembly name="IoC.Configuration.Tests" alias="tests" />

        <assembly name="TestProjects.DynamicallyLoadedAssembly1" alias="dynamic1" />
    </assemblies>

    <typeDefinitions>

    </typeDefinitions>

    <parameterSerializers>
        <serializers></serializers>
    </parameterSerializers>

    <!--The value of type attribute should be a type that implements 
    IoC.Configuration.DiContainer.IDiManager-->
    <diManagers activeDiManagerName="Autofac">
        <diManager name="Ninject" type="IoC.Configuration.Ninject.NinjectDiManager"
                   assembly="ninject_ext">
            <!--
            Use parameters element to specify constructor parameters,
            if the type specified in 'type' attribute has non-default constructor.
            -->
            <!--<parameters>
            </parameters>-->
        </diManager>

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

    <!--
    If settingsRequestor element is used, the type in type attribute should 
    specify a type that implements IoC.Configuration.ISettingsRequestor. 
    The implementation specifies a collection of required settings that should be present
    in settings element.
    Note, the type specified in type attribute is fully integrated into a dependency 
    injection framework. In other words, constructor parameters will be injected using 
    bindings specified in dependencyInjection element.
    -->

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

    <dependencyInjection>
        <modules>

        </modules>
        <services>
            <service type="SharedServices.Interfaces.IDbConnection" >
                <valueImplementation scope="singleton">
                    <constructedValue type="SharedServices.Implementations.SqlServerDbConnection">
                        <parameters>
                            <string name="serverName" value="MainServer"/>
                            <string name="databaseName" value="DB1"/>
                            <string name="userName" value="sa"/>
                            <string name="password" value="password1"/>
                        </parameters>
                    </constructedValue>
                </valueImplementation>
            </service>

        </services>
        <autoGeneratedServices>

            <!--Interface specified in autoServiceCustom is auto-implemented by implementation of 
            IoC.Configuration.ConfigurationFile.ICustomAutoServiceCodeGenerator IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.RepositoryInterfaceImplementationGenerator
            that is specified in autoServiceCodeGenerator element.-->
            <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>

            <!--Custom auto service to test failures-->
            <autoServiceCustom interface="IoC.Configuration.Tests.AutoServiceCustom.ClassesForFailureTests.DogAbstr">
                <autoServiceCodeGenerator>
                    <constructedValue type="IoC.Configuration.Tests.AutoServiceCustom.ClassesForFailureTests.CustomAutoServiceCodeGeneratorForFailureTests" >
                        <parameters>
                            <boolean name="simulateValidateFails" value="false"/>
                            <boolean name="simulateValidateOnIoCContainerLoadedFails" value="false"/>
                            <boolean name="simulateGenerateCSharpFailure" value="false"/>
                            <boolean name="simulateAssemblyBuildFailure" value="false"/>
                        </parameters>
                    </constructedValue>
                </autoServiceCodeGenerator>
            </autoServiceCustom>
        </autoGeneratedServices>

    </dependencyInjection>

    <startupActions>

    </startupActions>

    <pluginsSetup>
    </pluginsSetup>
</iocConfiguration>