annotate Implab.ServiceHost/Unity/ValueElement.cs @ 278:6691aff01de1 v3

Implab: added XmlDefaultSeializer (SerializersPool is now obsolete) Implab.ServiceHost: rewritten TypeReference (added support for nested types), stable API
author cin
date Thu, 03 May 2018 09:59:44 +0300
parents 963b17c275be
children 8714471e8d78
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
273
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
1 using System.Xml.Serialization;
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
2
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
3 namespace Implab.ServiceHost.Unity {
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
4 public class ValueElement : InstanceAbstractRegistration {
273
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
5
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
6 [XmlAttribute("value")]
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
7 public string Value { get; set; }
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
8
274
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
9 [XmlText]
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
10 public string Text { get; set; }
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
11
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
12 string GetTextValue() {
963b17c275be Refactoring
cin
parents: 274
diff changeset
13 return string.IsNullOrEmpty(Value) ? Text : Value;
274
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
14 }
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
15
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
16 public string TypeName {
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
17 get {
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
18 return RegistrationType;
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
19 }
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
20 }
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
21
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
22 public override void Visit(InstanceRegistrationBuilder builder) {
963b17c275be Refactoring
cin
parents: 274
diff changeset
23 base.Visit(builder);
963b17c275be Refactoring
cin
parents: 274
diff changeset
24 var parameter = new ValueParameterElement {
963b17c275be Refactoring
cin
parents: 274
diff changeset
25 Value = Value,
963b17c275be Refactoring
cin
parents: 274
diff changeset
26 Text = Text
963b17c275be Refactoring
cin
parents: 274
diff changeset
27 };
963b17c275be Refactoring
cin
parents: 274
diff changeset
28 parameter.Visit(builder.ValueBuilder);
273
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
29 }
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
30 }
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
31 }