comparison Implab.ServiceHost/Unity/RegisterElement.cs @ 273:79110a16cab7 v3

Working on Unity xml configuration: Refactoring in progress
author cin
date Thu, 26 Apr 2018 19:35:01 +0300
parents 9d1cca834b05
children 22629bf26121
comparison
equal deleted inserted replaced
272:9d1cca834b05 273:79110a16cab7
9 public class RegisterElement : AbstractRegistration { 9 public class RegisterElement : AbstractRegistration {
10 10
11 /// <summary> 11 /// <summary>
12 /// 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">.
13 /// </summary> 13 /// </summary>
14 [XmlAttribute("type")] 14 [XmlAttribute("mapTo")]
15 public string ImplementationType { get; set; } 15 public string MapToType { get; set; }
16 16
17 17
18 [XmlElement("constructor", typeof(ConstructorInjectionElement))] 18 [XmlElement("constructor", typeof(ConstructorInjectionElement))]
19 [XmlElement("property", typeof(PropertyInjectionElement))] 19 [XmlElement("property", typeof(PropertyInjectionElement))]
20 [XmlElement("method", typeof(MethodInjectionElement))] 20 [XmlElement("method", typeof(MethodInjectionElement))]
21 public AbstractInjectionElement[] Injectors { get; set; } 21 public AbstractInjectionElement[] Injectors { get; set; }
22 22
23 public override void Visit(ConfigurationContext context) { 23 public override void Visit(ContainerContext context) {
24 context.Visit(this); 24 context.Visit(this);
25 }
26
27 public virtual Type ResolveImplementationType(ContainerContext ctx) {
28 return string.IsNullOrEmpty(MapToType) ?
29 ResolveRegistrationType(ctx) :
30 ctx.Resolve(MapToType);
25 } 31 }
26 } 32 }
27 33
28 } 34 }