generic.services.xml
64 lines
| 2.0 KiB
| application/xml
|
XmlLexer
cin
|
r289 | <?xml version="1.0"?> | |
<container xmlns="http://implab.org/schemas/servicehost/unity.v1.xsd"> | |||
<namespace name="System"/> | |||
<namespace name="System.Collections.Generic"/> | |||
<namespace name="Implab.Components"/> | |||
<namespace name="Implab.ServiceHost.Test.Mock"/> | |||
<register name="Big" type="Baz+Nut"> | |||
<property name="Size"> | |||
<value>5</value> | |||
</property> | |||
</register> | |||
<register name="Mid" type="Baz+Nut"> | |||
<property name="Size"> | |||
<value>3</value> | |||
</property> | |||
</register> | |||
<register name="Small" type="Baz+Nut"> | |||
<property name="Size"> | |||
<value>1</value> | |||
</property> | |||
</register> | |||
<register type="Baz+Nut"> | |||
<property name="Size"> | |||
<value>2</value> | |||
</property> | |||
</register> | |||
<!-- register a generic interface mapping to the generic type --> | |||
<register type="IBox{}" mapTo="Box{}"> | |||
<property name="Value"> | |||
<!-- the dependency type is implied from the property and will be the generic parameter {T} --> | |||
<dependency optional="true"/> | |||
</property> | |||
</register> | |||
<factory name="Box2" type="BoxFactory{}"> | |||
</factory> | |||
<register type="IBox{String}" mapTo="Box{String}"> | |||
<property name="Name"> | |||
<value>boxForString</value> | |||
</property> | |||
</register> | |||
<register name="Small" type="IBox{}" mapTo="Box{}"> | |||
<property name="Value"> | |||
<dependency name="Small" optional="true"/> | |||
</property> | |||
</register> | |||
<register type="SetOfBoxes{}"> | |||
<constructor/> | |||
<method name="BoxValues"> | |||
<!-- only generic parameter or type without unresolved parameters | |||
can be used, this is a limitation of Unity container. TODO --> | |||
<array itemsType="T"> | |||
<default /> | |||
<dependency optional="true"/> | |||
<dependency name="Small" optional="true"/> | |||
</array> | |||
</method> | |||
</register> | |||
</container> |