comparison Implab.ServiceHost/Unity/ValueElement.cs @ 277:963b17c275be v3

Refactoring Added <array> element to injection parameters Working on registrations of factories
author cin
date Sat, 28 Apr 2018 18:48:09 +0300
parents 22629bf26121
children 8714471e8d78
comparison
equal deleted inserted replaced
276:b4e0f81c7425 277:963b17c275be
1 using System.Xml.Serialization; 1 using System.Xml.Serialization;
2 2
3 namespace Implab.ServiceHost.Unity { 3 namespace Implab.ServiceHost.Unity {
4 public class ValueElement : AbstractRegistration, ITextValue { 4 public class ValueElement : InstanceAbstractRegistration {
5 5
6 [XmlAttribute("value")] 6 [XmlAttribute("value")]
7 public string Value { get; set; } 7 public string Value { get; set; }
8 8
9 [XmlText] 9 [XmlText]
10 public string Text { get; set; } 10 public string Text { get; set; }
11 11
12 string ITextValue.Value { 12 string GetTextValue() {
13 get { 13 return string.IsNullOrEmpty(Value) ? Text : Value;
14 return string.IsNullOrEmpty(Value) ? Text : Value;
15 }
16 } 14 }
17 15
18 public string TypeName { 16 public string TypeName {
19 get { 17 get {
20 return RegistrationType; 18 return RegistrationType;
21 } 19 }
22 } 20 }
23 21
24 public override void Visit(ContainerBuilder context) { 22 public override void Visit(InstanceRegistrationBuilder builder) {
25 context.Visit(this); 23 base.Visit(builder);
24 var parameter = new ValueParameterElement {
25 Value = Value,
26 Text = Text
27 };
28 parameter.Visit(builder.ValueBuilder);
26 } 29 }
27 } 30 }
28 } 31 }