您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

320 行
12 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3. xmlns="http://schemas.microsoft.com/practices/2010/unity"
  4. targetNamespace="http://schemas.microsoft.com/practices/2010/unity"
  5. elementFormDefault="qualified"
  6. attributeFormDefault="unqualified">
  7. <!-- Core unity config -->
  8. <xs:element name="unity" type="UnityConfigurationSection" />
  9. <xs:complexType name="UnityConfigurationSection">
  10. <xs:sequence>
  11. <xs:choice minOccurs="0" maxOccurs="unbounded">
  12. <xs:element name="container" type="ContainerElement"/>
  13. <xs:element name="alias" type="AliasElement" />
  14. <xs:element name="sectionExtension" type="SectionExtensionElement" />
  15. <xs:element name="namespace" type="NamedElement" />
  16. <xs:element name="assembly" type="NamedElement" />
  17. </xs:choice>
  18. </xs:sequence>
  19. </xs:complexType>
  20. <xs:complexType name="Containers">
  21. <xs:sequence>
  22. <xs:element name="container" minOccurs="0" maxOccurs="unbounded" type="ContainerElement"/>
  23. </xs:sequence>
  24. </xs:complexType>
  25. <xs:complexType name="ContainerElement">
  26. <xs:sequence>
  27. <xs:choice minOccurs="0" maxOccurs="unbounded">
  28. <xs:element name="instance" type="InstanceElement"/>
  29. <xs:element name="register" type="RegisterElement"/>
  30. <xs:element name="extension" type="ContainerExtensionElement"/>
  31. <xs:element name="interception" type="InterceptionElement"/>
  32. <xs:element name="interceptors" type="InterceptorsElement"/>
  33. </xs:choice>
  34. </xs:sequence>
  35. <xs:attribute name="name" type="IdentifierName_Type"/>
  36. </xs:complexType>
  37. <xs:complexType name="InstanceElement">
  38. <xs:attribute name="name" type="IdentifierName_Type"/>
  39. <xs:attribute name="type" type="TypeName_Type"/>
  40. <xs:attribute name="value" type="LiteralValue_Type"/>
  41. <xs:attribute name="typeConverter" type="TypeName_Type"/>
  42. </xs:complexType>
  43. <xs:complexType name="ContainerExtensionElement">
  44. <xs:attribute name="type" type="ContainerExtensionTypeName_Type" use="required"/>
  45. </xs:complexType>
  46. <xs:complexType name="RegisterElement">
  47. <xs:group ref="InjectionGroup"/>
  48. <xs:attribute name="type" type="TypeName_Type" use="required" />
  49. <xs:attribute name="name" type="IdentifierName_Type" />
  50. <xs:attribute name="mapTo" type="TypeName_Type"/>
  51. </xs:complexType>
  52. <xs:complexType name="LifetimeElement">
  53. <xs:attribute name="type" type="LifetimeTypeName_Type" use="required"/>
  54. <xs:attribute name="value" type="LiteralValue_Type"/>
  55. <xs:attribute name="typeConverter" type="TypeName_Type"/>
  56. </xs:complexType>
  57. <xs:complexType name="ConstructorElement">
  58. <xs:sequence minOccurs="0" maxOccurs="unbounded">
  59. <xs:element name="param" type="ParameterElement"/>
  60. </xs:sequence>
  61. </xs:complexType>
  62. <xs:complexType name="MethodElement">
  63. <xs:sequence minOccurs="0" maxOccurs="unbounded">
  64. <xs:element name="param" type="ParameterElement"/>
  65. </xs:sequence>
  66. <xs:attribute name="name" type="IdentifierName_Type" use="required"/>
  67. </xs:complexType>
  68. <xs:complexType name="PropertyElement">
  69. <xs:group ref="ValueResolutionGroup" minOccurs="0"/>
  70. <xs:attribute name="name" type="IdentifierName_Type" use="required"/>
  71. <xs:attributeGroup ref="ValueOptimizationAttributes"/>
  72. </xs:complexType>
  73. <xs:complexType name="ParameterElement">
  74. <xs:group ref="ValueResolutionGroup" minOccurs="0"/>
  75. <xs:attribute name="name" type="IdentifierName_Type"/>
  76. <xs:attribute name="type" type="TypeName_Type"/>
  77. <xs:attributeGroup ref="ValueOptimizationAttributes"/>
  78. </xs:complexType>
  79. <xs:complexType name="DependencyElement">
  80. <xs:attribute name="name" type="IdentifierName_Type"/>
  81. <xs:attribute name="type" type="TypeName_Type"/>
  82. </xs:complexType>
  83. <xs:complexType name="ValueElement">
  84. <xs:attribute name="value" type="LiteralValue_Type"/>
  85. <xs:attribute name="typeConverter" type="TypeName_Type"/>
  86. </xs:complexType>
  87. <xs:complexType name="ArrayElement">
  88. <xs:group ref="ValueResolutionGroup" minOccurs="0" maxOccurs="unbounded"/>
  89. <xs:attribute name="type" type="TypeName_Type"/>
  90. </xs:complexType>
  91. <xs:complexType name="OptionalElement">
  92. <xs:attribute name="name" type="IdentifierName_Type"/>
  93. <xs:attribute name="type" type="TypeName_Type"/>
  94. </xs:complexType>
  95. <xs:complexType name="AliasElement">
  96. <xs:attribute name="alias" type="IdentifierName_Type" use="required"/>
  97. <xs:attribute name="type" type="TypeName_Type" use="required"/>
  98. </xs:complexType>
  99. <xs:complexType name="SectionExtensionElement">
  100. <xs:attribute name="prefix" type="IdentifierName_Type"/>
  101. <xs:attribute name="type" type="SectionExtensionTypeName_Type" use="required"/>
  102. </xs:complexType>
  103. <xs:attributeGroup name="ValueOptimizationAttributes">
  104. <xs:attribute name="value" type="LiteralValue_Type"/>
  105. <xs:attribute name="dependencyName" type="IdentifierName_Type"/>
  106. <xs:attribute name="dependencyType" type="TypeName_Type"/>
  107. </xs:attributeGroup>
  108. <xs:group name="ValueResolutionGroup">
  109. <xs:choice>
  110. <xs:element name="value" type="ValueElement"/>
  111. <xs:element name="dependency" type="DependencyElement"/>
  112. <xs:element name="array" type="ArrayElement"/>
  113. <xs:element name="optional" type="OptionalElement"/>
  114. </xs:choice>
  115. </xs:group>
  116. <xs:group name="InjectionGroup">
  117. <xs:sequence>
  118. <xs:element minOccurs="0" name="lifetime" type="LifetimeElement"/>
  119. <xs:element minOccurs="0" name="constructor" type="ConstructorElement"/>
  120. <xs:choice minOccurs="0" maxOccurs="unbounded">
  121. <xs:element name="method" type="MethodElement"/>
  122. <xs:element name="property" type="PropertyElement"/>
  123. <xs:element name="interceptor" type="InterceptorElement"/>
  124. <xs:element name="interceptionBehavior" type="InterceptionBehaviorElement"/>
  125. <xs:element name="addInterface" type="AddInterfaceElement"/>
  126. <xs:element name="policyInjection" type="PolicyInjectionElement"/>
  127. </xs:choice>
  128. </xs:sequence>
  129. </xs:group>
  130. <!-- Interception config -->
  131. <xs:complexType name="InterceptionElement">
  132. <xs:choice minOccurs="0" maxOccurs="unbounded">
  133. <xs:element name="policy" type="PolicyElement"/>
  134. </xs:choice>
  135. </xs:complexType>
  136. <xs:complexType name="PolicyElement">
  137. <xs:choice minOccurs="0" maxOccurs="unbounded">
  138. <xs:element name="callHandler" type="CallHandlerElement"/>
  139. <xs:element name="matchingRule" type="MatchingRuleElement"/>
  140. </xs:choice>
  141. <xs:attribute name="name" type="IdentifierName_Type" use="required"/>
  142. </xs:complexType>
  143. <xs:complexType name="CallHandlerElement">
  144. <xs:group ref="InjectionGroup"/>
  145. <xs:attribute name="type" type="TypeName_Type"/>
  146. <xs:attribute name="name" type="IdentifierName_Type" use="required"/>
  147. </xs:complexType>
  148. <xs:complexType name="MatchingRuleElement">
  149. <xs:group ref="InjectionGroup"/>
  150. <xs:attribute name="type" type="MatchingRuleTypeName_Type"/>
  151. <xs:attribute name="name" type="IdentifierName_Type" use="required"/>
  152. </xs:complexType>
  153. <xs:complexType name="InterceptorElement">
  154. <xs:attribute name="name" type="IdentifierName_Type"/>
  155. <xs:attribute name="type" type="InterceptorTypeName_Type"/>
  156. <xs:attribute name="isDefaultForType" type="boolean_Type2"/>
  157. </xs:complexType>
  158. <xs:complexType name="InterceptionBehaviorElement">
  159. <xs:attribute name="name" type="IdentifierName_Type"/>
  160. <xs:attribute name="type" type="TypeName_Type"/>
  161. <xs:attribute name="isDefaultForType" type="boolean_Type2"/>
  162. </xs:complexType>
  163. <xs:complexType name="AddInterfaceElement">
  164. <xs:attribute name="type" type="TypeName_Type" use="required"/>
  165. </xs:complexType>
  166. <xs:complexType name="PolicyInjectionElement"/>
  167. <xs:complexType name="InterceptorsElement">
  168. <xs:sequence minOccurs="0" maxOccurs="unbounded">
  169. <xs:element name="interceptor" type="InterceptorsInterceptorElement"/>
  170. </xs:sequence>
  171. </xs:complexType>
  172. <xs:complexType name="InterceptorsInterceptorElement">
  173. <xs:choice minOccurs="0" maxOccurs="unbounded">
  174. <xs:element name="key" type="KeyElement"/>
  175. <xs:element name="default" type="DefaultElement"/>
  176. </xs:choice>
  177. <xs:attribute name="type" type="InterceptorTypeName_Type"/>
  178. <xs:attribute name="value" type="LiteralValue_Type"/>
  179. <xs:attribute name="typeConverter" type="TypeName_Type"/>
  180. </xs:complexType>
  181. <xs:complexType name="KeyElement">
  182. <xs:attribute name="type" type="TypeName_Type" use="required"/>
  183. <xs:attribute name="name" type="IdentifierName_Type"/>
  184. </xs:complexType>
  185. <xs:complexType name="DefaultElement">
  186. <xs:attribute name="type" type="TypeName_Type" use="required"/>
  187. </xs:complexType>
  188. <!-- common types -->
  189. <xs:simpleType name="LiteralValue_Type">
  190. <xs:restriction base="xs:string"/>
  191. </xs:simpleType>
  192. <xs:simpleType name="TypeName_Type">
  193. <xs:restriction base="xs:string"/>
  194. </xs:simpleType>
  195. <xs:simpleType name="LifetimeTypeName_Type">
  196. <xs:union memberTypes="TypeName_Type">
  197. <xs:simpleType>
  198. <xs:restriction base="xs:NMTOKEN">
  199. <xs:enumeration value="singleton"/>
  200. <xs:enumeration value="transient"/>
  201. <xs:enumeration value="perthread"/>
  202. <xs:enumeration value="external"/>
  203. <xs:enumeration value="hierarchical"/>
  204. <xs:enumeration value="resolve"/>
  205. <xs:enumeration value="perresolve"/>
  206. </xs:restriction>
  207. </xs:simpleType>
  208. </xs:union>
  209. </xs:simpleType>
  210. <xs:simpleType name="ContainerExtensionTypeName_Type">
  211. <xs:union memberTypes="TypeName_Type">
  212. <xs:simpleType>
  213. <xs:restriction base="xs:NMTOKEN">
  214. <xs:enumeration value="Interception"/>
  215. </xs:restriction>
  216. </xs:simpleType>
  217. </xs:union>
  218. </xs:simpleType>
  219. <xs:simpleType name="SectionExtensionTypeName_Type">
  220. <xs:union memberTypes="TypeName_Type">
  221. <xs:simpleType>
  222. <xs:restriction base="xs:string">
  223. <xs:enumeration value="Microsoft.Practices.Unity.InterceptionExtension.Configuration.InterceptionConfigurationExtension, Microsoft.Practices.Unity.Interception.Configuration"/>
  224. </xs:restriction>
  225. </xs:simpleType>
  226. </xs:union>
  227. </xs:simpleType>
  228. <xs:simpleType name="InterceptorTypeName_Type">
  229. <xs:union memberTypes="TypeName_Type">
  230. <xs:simpleType>
  231. <xs:restriction base="xs:NMTOKEN">
  232. <xs:enumeration value="VirtualMethodInterceptor"/>
  233. <xs:enumeration value="InterfaceInterceptor"/>
  234. <xs:enumeration value="TransparentProxyInterceptor"/>
  235. </xs:restriction>
  236. </xs:simpleType>
  237. </xs:union>
  238. </xs:simpleType>
  239. <xs:simpleType name="MatchingRuleTypeName_Type">
  240. <xs:union memberTypes="TypeName_Type">
  241. <xs:simpleType>
  242. <xs:restriction base="xs:NMTOKEN">
  243. <xs:enumeration value="AssemblyMatchingRule"/>
  244. <xs:enumeration value="CustomAttributeMatchingRule"/>
  245. <xs:enumeration value="MemberNameMatchingRule"/>
  246. <xs:enumeration value="NamespaceMatchingRule"/>
  247. <xs:enumeration value="ParameterTypeMatchingRule"/>
  248. <xs:enumeration value="PropertyMatchingRule"/>
  249. <xs:enumeration value="TagAttributeMatchingRule"/>
  250. <xs:enumeration value="TypeMatchingRule"/>
  251. </xs:restriction>
  252. </xs:simpleType>
  253. </xs:union>
  254. </xs:simpleType>
  255. <xs:simpleType name="IdentifierName_Type">
  256. <xs:restriction base="xs:string"/>
  257. </xs:simpleType>
  258. <xs:simpleType name="boolean_Type2">
  259. <xs:restriction base="xs:boolean">
  260. <xs:pattern value="true" />
  261. <xs:pattern value="false" />
  262. </xs:restriction>
  263. </xs:simpleType>
  264. <xs:complexType name="Empty"/>
  265. <xs:complexType name="NamedElement">
  266. <xs:attribute name="name" type="IdentifierName_Type" use="required"/>
  267. </xs:complexType>
  268. </xs:schema>