Mercurial > pub > ImplabNet
annotate Implab.ServiceHost/Unity/ValueParameterElement.cs @ 279:8714471e8d78 v3
Container configuration cleanup, RC2
| author | cin |
|---|---|
| date | Fri, 04 May 2018 18:12:42 +0300 |
| parents | 6691aff01de1 |
| children | e0916ddc9950 |
| rev | line source |
|---|---|
| 277 | 1 using System.ComponentModel; |
| 272 | 2 using System.Xml.Serialization; |
| 3 | |
| 274 | 4 namespace Implab.ServiceHost.Unity { |
| 277 | 5 public class ValueParameterElement : InjectionParameterElement { |
|
273
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
6 [XmlAttribute("value")] |
| 272 | 7 public string Value { get; set; } |
| 8 | |
| 277 | 9 [XmlText] |
| 10 public string Text { get; set; } | |
| 11 | |
| 12 string GetTextValue() { | |
| 13 return string.IsNullOrEmpty(Value) ? Text : Value; | |
| 14 } | |
| 15 | |
|
278
6691aff01de1
Implab: added XmlDefaultSeializer (SerializersPool is now obsolete)
cin
parents:
277
diff
changeset
|
16 public override void Visit(InjectionParameterBuilder builder) { |
| 277 | 17 var type = builder.ResolveInjectedValueType(TypeName); |
| 18 builder.SetValue(type, TypeDescriptor.GetConverter(type).ConvertFromString(GetTextValue())); | |
| 272 | 19 } |
| 270 | 20 } |
| 21 } |
