IoCConfiguration_constructedValue.xmlΒΆ
This configuration file can be downloaded downloaded from IoCConfiguration_constructedValue.xml.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | <?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. constructed
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_constructedValueTests" />
<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.Modules" alias="modules" />
<assembly name="TestProjects.DynamicallyLoadedAssembly1"
alias="dynamic1" />
<assembly name="TestProjects.DynamicallyLoadedAssembly2"
alias="dynamic2" />
<assembly name="TestProjects.SharedServices" alias="shared_services" />
<assembly name="IoC.Configuration.Tests" alias="tests" />
</assemblies>
<typeDefinitions>
<typeDefinition alias="IAppInfo" type="IoC.Configuration.Tests.ConstructedValue.Services.IAppInfo" />
<typeDefinition alias="AppInfo" type="IoC.Configuration.Tests.ConstructedValue.Services.AppInfo" />
</typeDefinitions>
<parameterSerializers>
<serializers>
<!--Serializer IoC.Configuration.Tests.ConstructedValue.Services.AppInfoSerializer will be used to de-serialize value
provided in element <object> into instance of type IoC.Configuration.Tests.ConstructedValue.Services.AppInfo-->
<parameterSerializer type="IoC.Configuration.Tests.ConstructedValue.Services.AppInfoSerializer">
<parameters>
<!--Demo of using constructedValue to inject constructor parameter value into parameter serializer.-->
<constructedValue name="appDescriptionFormatter" type="IoC.Configuration.Tests.ConstructedValue.Services.AppDescriptionFormatter">
<parameters>
<string name="prefixToAddToDescription" value="AppData::"/>
</parameters>
<injectedProperties>
<string name="PostfixToAddToDescription" value="::AppDataEnd"/>
</injectedProperties>
</constructedValue>
</parameters>
</parameterSerializer>
</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>
<object name="App1" typeRef="IAppInfo" value="1, App 1"/>
<!--Demo of constructedValue in settings element. -->
<constructedValue name="App2" typeRef="AppInfo" >
<parameters>
<int32 name="Id" value="2"/>
</parameters>
<injectedProperties>
<string name="Description" value="App 2"/>
</injectedProperties>
</constructedValue>
<!--Demo of constructedValue used as a parameter value in another constructedValue.
Constructing DecoratedAppInfo setting below is similar to creating an instance of AppInfoDecorator using the following C# code:
new AppInfoDecorator(new AppInfoDecorator(new AppInfo(25, "App 25")))
-->
<constructedValue name="DecoratedAppInfo" type="IoC.Configuration.Tests.ConstructedValue.Services.AppInfoDecorator">
<parameters>
<constructedValue name="appInfo" type="IoC.Configuration.Tests.ConstructedValue.Services.AppInfoDecorator">
<parameters>
<constructedValue name="appInfo" typeRef="AppInfo">
<parameters>
<int32 name="id" value="25"/>
</parameters>
<injectedProperties>
<string name="Description" value="App 25"/>
</injectedProperties>
</constructedValue>
</parameters>
</constructedValue>
</parameters>
</constructedValue>
</settings>
<dependencyInjection>
<modules>
<module type="IoC.Configuration.Tests.ConstructedValue.Module1">
<parameters>
<!--Demo of constructedValue to inject constructor parameter and property into module. -->
<constructedValue name="appInfo" typeRef="AppInfo">
<parameters>
<int32 name="id" value="3"/>
</parameters>
<injectedProperties>
<string name="Description" value="App 3"/>
</injectedProperties>
</constructedValue>
</parameters>
</module>
</modules>
<services>
<service typeRef="IAppInfo">
<valueImplementation scope="singleton">
<!--Demo of constructedValue to provide an implementation for a service under valueImplementation element.-->
<constructedValue typeRef="AppInfo">
<parameters>
<int32 name="id" value="8"/>
</parameters>
<injectedProperties>
<string name="Description" value="App 8"/>
</injectedProperties>
</constructedValue>
</valueImplementation>
</service>
<service type="System.Collections.Generic.IReadOnlyList[IoC.Configuration.Tests.ConstructedValue.Services.IAppInfo]">
<valueImplementation scope="singleton">
<collection>
<!--Demo of constructedValue in collection-->
<constructedValue typeRef="AppInfo">
<parameters>
<int32 name="id" value="10"/>
</parameters>
<injectedProperties>
<string name="Description" value="App 10"/>
</injectedProperties>
</constructedValue>
<settingValue settingName="App1"/>
</collection>
</valueImplementation>
</service>
</services>
<autoGeneratedServices>
<!--The scope for autoService implementations is always singleton -->
<autoService interface="IoC.Configuration.Tests.ConstructedValue.Services.IAppInfoFactory">
<autoProperty name="DefaultAppInfo" returnTypeRef="IAppInfo">
<!--Demo of constructedValue in autoProperty-->
<constructedValue typeRef="AppInfo" >
<parameters>
<int32 name="id" value="11"/>
</parameters>
<injectedProperties>
<string name="Description" value="App 11"/>
</injectedProperties>
</constructedValue>
</autoProperty>
<!--Demo of constructedValue in autoMethod-->
<autoMethod name="CreateAppInfo" returnTypeRef="IAppInfo">
<default>
<constructedValue typeRef="AppInfo" >
<parameters>
<int32 name="id" value="12"/>
</parameters>
<injectedProperties>
<string name="Description" value="App 12"/>
</injectedProperties>
</constructedValue>
</default>
</autoMethod>
</autoService>
</autoGeneratedServices>
</dependencyInjection>
<startupActions>
<startupAction type="IoC.Configuration.Tests.ConstructedValue.Services.StartupAction1">
<parameters>
<constructedValue name="appInfo" typeRef="AppInfo">
<parameters>
<int32 name="id" value="9"/>
</parameters>
<injectedProperties>
<string name="Description" value="App 9"/>
</injectedProperties>
</constructedValue>
</parameters>
</startupAction>
</startupActions>
<pluginsSetup>
</pluginsSetup>
</iocConfiguration>
|