configuration/tests/ConfigFiles/InjectingProperties.config

40 строки
1.5 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Unity.Configuration"/>
</configSections>
<unity>
<aliases>
<add alias="ILogger" type="Microsoft.Practices.Unity.TestSupport.ILogger, Configuration.Tests" />
<add alias="SpecialLogger" type="Microsoft.Practices.Unity.TestSupport.SpecialLogger, Configuration.Tests" />
<add alias="ObjectWithTwoProperties" type="Microsoft.Practices.Unity.TestSupport.ObjectWithTwoProperties, Configuration.Tests" />
<add alias="SpecialLogger" type="Microsoft.Practices.Unity.TestSupport.SpecialLogger, Configuration.Tests" />
</aliases>
<container>
<register type="ILogger" name="special" mapTo="SpecialLogger" />
<register type="object" name="special">
<lifetime type="singleton" />
</register>
<register type="ObjectWithTwoProperties" name="singleProperty">
<property name="Obj1">
<dependency name="special" />
</property>
</register>
<register type="ObjectWithTwoProperties" name="twoProperties">
<property name="Obj1" dependencyName="special" />
<property name="Obj2" />
</register>
<register type="ObjectWithTwoProperties" name="injectingDifferentType">
<property name="Obj1" dependencyName="special" dependencyType="ILogger" />
<property name="Obj2" dependencyName="special" />
</register>
</container>
</unity>
</configuration>