SerializedElement.cs
42 lines
| 1.2 KiB
| text/x-csharp
|
CSharpLexer
cin
|
r273 | using System; | |
using System.Xml; | |||
using System.Xml.Serialization; | |||
namespace Implab.ServiceHost.Unity | |||
{ | |||
cin
|
r274 | public class SerializedElement : AbstractRegistration, ISerializedValue { | |
cin
|
r273 | [XmlAttribute("href")] | |
public string Location { get; set; } | |||
[XmlAttribute("serializedType")] | |||
public string SerializedType { get; set; } | |||
[XmlAnyElement] | |||
public XmlElement[] Content { get; set; } | |||
cin
|
r274 | ||
string ISerializedValue.TypeName { | |||
get { | |||
return string.IsNullOrEmpty(SerializedType) ? RegistrationType : SerializedType; | |||
} | |||
} | |||
cin
|
r275 | public string TypeName => throw new NotImplementedException(); | |
cin
|
r274 | public override void Visit(ContainerBuilder context) { | |
cin
|
r273 | context.Visit(this); | |
} | |||
cin
|
r274 | public XmlReader GetReader() { | |
if (!string.IsNullOrEmpty(Location)) | |||
return XmlReader.Create(Location); | |||
if (Content != null && Content.Length > 0) | |||
return Content[0].CreateNavigator().ReadSubtree(); | |||
cin
|
r273 | ||
cin
|
r274 | throw new Exception("No content found, expected XML document"); | |
cin
|
r273 | } | |
cin
|
r275 | ||
public void Visit(InjectionValueBuilder builder) { | |||
throw new NotImplementedException(); | |||
} | |||
cin
|
r273 | } | |
} |