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