Mercurial > pub > ImplabNet
comparison Implab.ServiceHost/Unity/SerializedParameterElement.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 | 6fefd5811b9b |
children | 6691aff01de1 |
comparison
equal
deleted
inserted
replaced
276:b4e0f81c7425 | 277:963b17c275be |
---|---|
3 using System.Xml.Schema; | 3 using System.Xml.Schema; |
4 using System.Xml.Serialization; | 4 using System.Xml.Serialization; |
5 | 5 |
6 namespace Implab.ServiceHost.Unity | 6 namespace Implab.ServiceHost.Unity |
7 { | 7 { |
8 public class SerializedParameterElement : InjectionParameterElement, ISerializedValue { | 8 public class SerializedParameterElement : InjectionParameterElement { |
9 [XmlAttribute("href")] | 9 [XmlAttribute("href")] |
10 public string Location { get; set; } | 10 public string Location { get; set; } |
11 | 11 |
12 [XmlAnyElement] | 12 [XmlAnyElement] |
13 public XmlElement[] Content { get; set; } | 13 public XmlElement[] Content { get; set; } |
20 | 20 |
21 throw new Exception("No content found, expected XML document"); | 21 throw new Exception("No content found, expected XML document"); |
22 } | 22 } |
23 | 23 |
24 public override void Visit(InjectionValueBuilder builder) { | 24 public override void Visit(InjectionValueBuilder builder) { |
25 builder.Visit(this); | 25 var type = builder.ResolveInjectedValueType(TypeName); |
26 | |
27 var serializer = new XmlSerializer(type); | |
28 using(var reader = GetReader()) | |
29 builder.SetValue(type, serializer.Deserialize(reader)); | |
30 | |
26 } | 31 } |
27 } | 32 } |
28 } | 33 } |