Mercurial > pub > ImplabNet
comparison Implab.ServiceHost/Unity/SerializedParameterElement.cs @ 274:22629bf26121 v3
Unity xml configuration, alpha2
| author | cin |
|---|---|
| date | Fri, 27 Apr 2018 04:47:52 +0300 |
| parents | 79110a16cab7 |
| children | 6fefd5811b9b |
comparison
equal
deleted
inserted
replaced
| 273:79110a16cab7 | 274:22629bf26121 |
|---|---|
| 1 using System; | |
| 1 using System.Xml; | 2 using System.Xml; |
| 2 using System.Xml.Schema; | 3 using System.Xml.Schema; |
| 3 using System.Xml.Serialization; | 4 using System.Xml.Serialization; |
| 4 | 5 |
| 5 namespace Implab.ServiceHost.Unity | 6 namespace Implab.ServiceHost.Unity |
| 6 { | 7 { |
| 7 public class SerializedParameterElement : InjectionParameterElement { | 8 public class SerializedParameterElement : InjectionParameterElement, ISerializedValue { |
| 8 [XmlAttribute("href")] | 9 [XmlAttribute("href")] |
| 9 public string Location { get; set; } | 10 public string Location { get; set; } |
| 10 | 11 |
| 11 [XmlAnyElement] | 12 [XmlAnyElement] |
| 12 public XmlElement[] Content { get; set; } | 13 public XmlElement[] Content { get; set; } |
| 13 | 14 |
| 14 internal override object Resolve(RegistrationContext context) { | 15 public XmlReader GetReader() { |
| 15 return context.Resolve(this); | 16 if (!string.IsNullOrEmpty(Location)) |
| 17 return XmlReader.Create(Location); | |
| 18 if (Content != null && Content.Length > 0) | |
| 19 return Content[0].CreateNavigator().ReadSubtree(); | |
| 20 | |
| 21 throw new Exception("No content found, expected XML document"); | |
| 22 } | |
| 23 | |
| 24 internal override void Visit(InjectionValueBuilder builder) { | |
| 25 builder.Visit(this); | |
| 16 } | 26 } |
| 17 } | 27 } |
| 18 } | 28 } |
