annotate Implab.ServiceHost/Unity/ValueElement.cs @ 281:e0916ddc9950 v3 tip

code cleanup and refactoring
author cin
date Fri, 01 Jun 2018 21:35:24 +0300
parents 8714471e8d78
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
279
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
1 using System.Collections.Generic;
273
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
2 using System.Xml.Serialization;
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
3
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
4 namespace Implab.ServiceHost.Unity {
279
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
5 public class ValueElement : AbstractRegistration, IInstanceRegistration {
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
6
273
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
7 [XmlAttribute("value")]
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
8 public string Value { get; set; }
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
9
274
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
10 [XmlText]
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
11 public string Text { get; set; }
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
12
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
13 string GetTextValue() {
963b17c275be Refactoring
cin
parents: 274
diff changeset
14 return string.IsNullOrEmpty(Value) ? Text : Value;
274
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
15 }
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
16
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
17 public string TypeName {
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
18 get {
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
19 return RegistrationType;
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
20 }
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
21 }
22629bf26121 Unity xml configuration, alpha2
cin
parents: 273
diff changeset
22
279
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
23 public IEnumerable<IInjectionParameter> MemberInjections {
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
24 get {
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
25 yield return new ValueParameterElement {
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
26 Value = Value,
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
27 Text = Text
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
28 };
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
29 }
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
30 }
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
31
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
32 public override void Visit(ContainerBuilder builder) {
8714471e8d78 Container configuration cleanup, RC2
cin
parents: 277
diff changeset
33 builder.Visit(this);
273
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
34 }
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
35 }
79110a16cab7 Working on Unity xml configuration: Refactoring in progress
cin
parents:
diff changeset
36 }