SerializedParameterElement.cs
27 lines
| 838 B
| text/x-csharp
|
CSharpLexer
cin
|
r274 | using System; | |
cin
|
r271 | using System.Xml; | |
using System.Xml.Schema; | |||
using System.Xml.Serialization; | |||
cin
|
r270 | namespace Implab.ServiceHost.Unity | |
{ | |||
cin
|
r274 | public class SerializedParameterElement : InjectionParameterElement, ISerializedValue { | |
cin
|
r273 | [XmlAttribute("href")] | |
public string Location { get; set; } | |||
cin
|
r271 | ||
[XmlAnyElement] | |||
public XmlElement[] Content { get; set; } | |||
cin
|
r272 | ||
cin
|
r274 | public XmlReader GetReader() { | |
if (!string.IsNullOrEmpty(Location)) | |||
return XmlReader.Create(Location); | |||
if (Content != null && Content.Length > 0) | |||
return Content[0].CreateNavigator().ReadSubtree(); | |||
throw new Exception("No content found, expected XML document"); | |||
} | |||
cin
|
r275 | public override void Visit(InjectionValueBuilder builder) { | |
cin
|
r274 | builder.Visit(this); | |
cin
|
r272 | } | |
cin
|
r270 | } | |
} |