IoCConfiguration_autoServiceCustom.xml

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

  1 <?xml version="1.0" encoding="utf-8"?>
  2
  3 <!--
  4    The XML configuration file is validated against schema file IoC.Configuration.Schema.22B4BA50-3429-48FE-8059-B9C1F855A639.xsd,
  5    which can be found in folder IoC.Configuration.Content in output directory.
  6    The schema file can also be downloaded from
  7    http://oroptimizer.com/ioc.configuration/V2/IoC.Configuration.Schema.22B4BA50-3429-48FE-8059-B9C1F855A639.xsd or in source code
  8    project in Github.com.
  9
 10    To use Visual Studio code completion based on schema contents, right click Properties on this file in Visual Studio, and in Schemas
 11    field pick the schema IoC.Configuration.Schema.22B4BA50-3429-48FE-8059-B9C1F855A639.xsd.
 12
 13    Before running the tests make sure to execute IoC.Configuration\Tests\IoC.Configuration.Tests\PostBuildCommands.bat to copy the dlls into
 14    folders specified in this configuration file.
 15    Also, modify the batch file to copy the Autofac and Ninject assemblies from Nuget packages folder on machine, where the test is run.
 16 -->
 17
 18 <iocConfiguration
 19     xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
 20     xsi:noNamespaceSchemaLocation="http://oroptimizer.com/IoC.Configuration/V2/IoC.Configuration.Schema.22B4BA50-3429-48FE-8059-B9C1F855A639.xsd">
 21
 22     <!--The application should have write permissions to path specified in appDataDir.
 23     This is where dynamically generated DLLs are saved.-->
 24     <!--NOTE: path should be an absolute path, or should be converted to absolute path by some implementation of
 25     IoC.Configuration.AttributeValueTransformer.IAttributeValueTransformer. In this example the paths are converted by
 26     IoC.Configuration.Tests.FileFolderPathAttributeValueTransformer.-->
 27     <appDataDir
 28             path="TestFiles\AutogeneratedDlls\DynamicFiles_AutoServiceCustomTests"  />
 29
 30     <plugins pluginsDirPath="TestFiles\PluginDlls">
 31
 32             <!--
 33         Plugin assemblies will be in a folder with similar name under pluginsDirPath folder.
 34         The plugin folders will be included in assembly resolution mechanism.
 35         -->
 36
 37             <!--A folder K:\...\IoC.Configuration\Tests\IoC.Configuration.Tests\bin\TestFiles\PluginDlls\Plugin1 should exist.  -->
 38     </plugins>
 39
 40     <additionalAssemblyProbingPaths>
 41             <probingPath
 42               path="TestFiles\ThirdPartyLibs" />
 43             <probingPath
 44               path="TestFiles\ContainerImplementations\Autofac" />
 45             <probingPath
 46               path="TestFiles\ContainerImplementations\Ninject" />
 47             <probingPath
 48               path="TestFiles\DynamicallyLoadedDlls" />
 49     </additionalAssemblyProbingPaths>
 50
 51     <assemblies>
 52             <!--Assemblies should be in one of the following locations:
 53         1) Executable's folder
 54         2) In folder specified in additionalAssemblyProbingPaths element.
 55         3) In one of the plugin folders specified in plugins element (only for assemblies with plugin attribute) -->
 56
 57             <!--
 58         Use "overrideDirectory" attribute, to make the assembly path explicit, rather then searching for
 59         an assembly in predefined folders, which also include probing paths specified in additionalAssemblyProbingPaths element.
 60         -->
 61             <assembly name="IoC.Configuration.Autofac" alias="autofac_ext" />
 62             <assembly name="IoC.Configuration.Ninject" alias="ninject_ext" />
 63
 64             <assembly name="TestProjects.SharedServices" alias="shared_services" />
 65             <assembly name="IoC.Configuration.Tests" alias="tests" />
 66
 67             <assembly name="TestProjects.DynamicallyLoadedAssembly1" alias="dynamic1" />
 68     </assemblies>
 69
 70     <typeDefinitions>
 71
 72     </typeDefinitions>
 73
 74     <parameterSerializers>
 75             <serializers></serializers>
 76     </parameterSerializers>
 77
 78     <!--The value of type attribute should be a type that implements
 79     IoC.Configuration.DiContainer.IDiManager-->
 80     <diManagers activeDiManagerName="Autofac">
 81             <diManager name="Ninject" type="IoC.Configuration.Ninject.NinjectDiManager"
 82                                assembly="ninject_ext">
 83                     <!--
 84             Use parameters element to specify constructor parameters,
 85             if the type specified in 'type' attribute has non-default constructor.
 86             -->
 87                     <!--<parameters>
 88             </parameters>-->
 89             </diManager>
 90
 91             <diManager name="Autofac" type="IoC.Configuration.Autofac.AutofacDiManager"
 92                                assembly="autofac_ext">
 93             </diManager>
 94     </diManagers>
 95
 96     <!--
 97     If settingsRequestor element is used, the type in type attribute should
 98     specify a type that implements IoC.Configuration.ISettingsRequestor.
 99     The implementation specifies a collection of required settings that should be present
100     in settings element.
101     Note, the type specified in type attribute is fully integrated into a dependency
102     injection framework. In other words, constructor parameters will be injected using
103     bindings specified in dependencyInjection element.
104     -->
105
106     <settings>
107             <boolean name="failCustomServiceValidation" value="false"/>
108     </settings>
109
110     <dependencyInjection>
111             <modules>
112
113             </modules>
114             <services>
115                     <service type="SharedServices.Interfaces.IDbConnection" >
116                             <valueImplementation scope="singleton">
117                                     <constructedValue type="SharedServices.Implementations.SqlServerDbConnection">
118                                             <parameters>
119                                                     <string name="serverName" value="MainServer"/>
120                                                     <string name="databaseName" value="DB1"/>
121                                                     <string name="userName" value="sa"/>
122                                                     <string name="password" value="password1"/>
123                                             </parameters>
124                                     </constructedValue>
125                             </valueImplementation>
126                     </service>
127
128             </services>
129             <autoGeneratedServices>
130
131                     <!--Interface specified in autoServiceCustom is auto-implemented by implementation of
132                     IoC.Configuration.ConfigurationFile.ICustomAutoServiceCodeGenerator IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.RepositoryInterfaceImplementationGenerator
133                     that is specified in autoServiceCodeGenerator element.-->
134                     <autoServiceCustom interface="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.DataRepositories.IAuthorsRepository">
135
136                             <autoServiceCodeGenerator>
137                                     <constructedValue type="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.RepositoryInterfaceImplementationGenerator">
138                                             <parameters>
139                                                     <int32 name="someDemoConstructorParameter" value="15" />
140                                             </parameters>
141                                     </constructedValue>
142                             </autoServiceCodeGenerator>
143                     </autoServiceCustom>
144
145                     <autoServiceCustom interface="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.DataRepositories.IBooksRepository">
146                             <autoServiceCodeGenerator>
147                                     <constructedValue type="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.RepositoryInterfaceImplementationGenerator">
148                                             <parameters>
149                                                     <int32 name="someDemoConstructorParameter" value="25" />
150                                             </parameters>
151                                     </constructedValue>
152                             </autoServiceCodeGenerator>
153                     </autoServiceCustom>
154
155                     <autoServiceCustom interface="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.DataRepositories.IAuthorBooksRepository">
156                             <autoServiceCodeGenerator>
157                                     <constructedValue type="IoC.Configuration.Tests.AutoServiceCustom.SimpleDataRepository.RepositoryInterfaceImplementationGenerator">
158                                             <parameters>
159                                                     <int32 name="someDemoConstructorParameter" value="35" />
160                                             </parameters>
161                                     </constructedValue>
162                             </autoServiceCodeGenerator>
163                     </autoServiceCustom>
164
165                     <!--Custom auto service to test failures-->
166                     <autoServiceCustom interface="IoC.Configuration.Tests.AutoServiceCustom.ClassesForFailureTests.DogAbstr">
167                             <autoServiceCodeGenerator>
168                                     <constructedValue type="IoC.Configuration.Tests.AutoServiceCustom.ClassesForFailureTests.CustomAutoServiceCodeGeneratorForFailureTests" >
169                                             <parameters>
170                                                     <boolean name="simulateValidateFails" value="false"/>
171                                                     <boolean name="simulateValidateOnIoCContainerLoadedFails" value="false"/>
172                                                     <boolean name="simulateGenerateCSharpFailure" value="false"/>
173                                                     <boolean name="simulateAssemblyBuildFailure" value="false"/>
174                                             </parameters>
175                                     </constructedValue>
176                             </autoServiceCodeGenerator>
177                     </autoServiceCustom>
178             </autoGeneratedServices>
179
180     </dependencyInjection>
181
182     <startupActions>
183
184     </startupActions>
185
186     <pluginsSetup>
187     </pluginsSetup>
188 </iocConfiguration>