Mercurial > pub > ImplabNet
annotate Implab.ServiceHost/Unity/ValueParameterElement.cs @ 281:e0916ddc9950 v3 tip
code cleanup and refactoring
author | cin |
---|---|
date | Fri, 01 Jun 2018 21:35:24 +0300 |
parents | 6691aff01de1 |
children |
rev | line source |
---|---|
277 | 1 using System.ComponentModel; |
272 | 2 using System.Xml.Serialization; |
3 | |
274 | 4 namespace Implab.ServiceHost.Unity { |
281 | 5 public class ValueParameterElement : AbstractInjectionParameter { |
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 } |