@@ -1,39 +1,38 | |||||
1 | using System; |
|
1 | using System; | |
2 | using System.Collections.Generic; |
|
2 | using System.Collections.Generic; | |
3 | using System.Xml.Serialization; |
|
3 | using System.Xml.Serialization; | |
4 | using Unity.Lifetime; |
|
4 | ||
5 | using Unity.Registration; |
|
|||
6 |
|
5 | |||
7 | namespace Implab.ServiceHost.Unity { |
|
6 | namespace Implab.ServiceHost.Unity { | |
8 |
|
7 | |||
9 | [XmlRoot("register", Namespace = Schema.ContainerConfigurationNamespace)] |
|
8 | [XmlRoot("register", Namespace = Schema.ContainerConfigurationNamespace)] | |
10 | public class RegisterElement : AbstractRegistration, ITypeRegistration { |
|
9 | public class RegisterElement : AbstractRegistration, ITypeRegistration { | |
11 |
|
10 | |||
12 | /// <summary> |
|
11 | /// <summary> | |
13 | /// An optional type which is registered as a service in the container, must be assignable to <see cref="ProvidesType">. |
|
12 | /// An optional type which is registered as a service in the container, must be assignable to <see cref="ProvidesType">. | |
14 | /// </summary> |
|
13 | /// </summary> | |
15 | [XmlAttribute("mapTo")] |
|
14 | [XmlAttribute("mapTo")] | |
16 | public string MapToType { get; set; } |
|
15 | public string MapToType { get; set; } | |
17 |
|
16 | |||
18 |
|
17 | |||
19 | [XmlElement("constructor", typeof(ConstructorInjectionElement))] |
|
18 | [XmlElement("constructor", typeof(ConstructorInjectionElement))] | |
20 | [XmlElement("property", typeof(PropertyInjectionElement))] |
|
19 | [XmlElement("property", typeof(PropertyInjectionElement))] | |
21 | [XmlElement("method", typeof(MethodInjectionElement))] |
|
20 | [XmlElement("method", typeof(MethodInjectionElement))] | |
22 | public AbstractMemberInjection[] Injectors { get; set; } |
|
21 | public AbstractMemberInjection[] Injectors { get; set; } | |
23 |
|
22 | |||
24 | IEnumerable<ITypeMemberInjection> ITypeRegistration.MemberInjections { |
|
23 | IEnumerable<ITypeMemberInjection> ITypeRegistration.MemberInjections { | |
25 | get { |
|
24 | get { | |
26 | return Injectors; |
|
25 | return Injectors; | |
27 | } |
|
26 | } | |
28 | } |
|
27 | } | |
29 |
|
28 | |||
30 | public Type GetImplementationType(ContainerBuilder builder) { |
|
29 | public Type GetImplementationType(ContainerBuilder builder) { | |
31 | return builder.ResolveType(MapToType); |
|
30 | return builder.ResolveType(MapToType); | |
32 | } |
|
31 | } | |
33 |
|
32 | |||
34 | public override void Visit(ContainerBuilder builder) { |
|
33 | public override void Visit(ContainerBuilder builder) { | |
35 | builder.Visit(this); |
|
34 | builder.Visit(this); | |
36 | } |
|
35 | } | |
37 | } |
|
36 | } | |
38 |
|
37 | |||
39 | } No newline at end of file |
|
38 | } |
General Comments 0
You need to be logged in to leave comments.
Login now