##// END OF EJS Templates
preview version of Unity xml configuration
preview version of Unity xml configuration

File last commit:

r271:d4d437ec4483 v3
r272:9d1cca834b05 v3
Show More
ContainerElement.cs
30 lines | 1017 B | text/x-csharp | CSharpLexer
cin
Working on Unity xml configuration
r267 using Implab.Xml;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace Implab.ServiceHost.Unity {
[XmlRoot("container", Namespace = Schema.ContainerConfigurationNamespace)]
public class ContainerElement : IXmlSerializable {
cin
Working on Unity container xml configuration
r270 public List<IConfigurationElement> Items {get; set; } = new List<IConfigurationElement>();
cin
Working on Unity xml configuration
r267
public XmlSchema GetSchema() {
return null;
}
public void ReadXml(XmlReader reader) {
while(reader.Read() && reader.NodeType != XmlNodeType.EndElement) {
cin
Working on Unity container xml configuration
r269 var registration = ConfigurationSchema.Default.Deserialize<IConfigurationElement>(reader);
cin
Working on Unity container xml configuration
r270 Items.Add(registration);
cin
Working on Unity xml configuration
r267 }
}
public void WriteXml(XmlWriter writer) {
cin
Working on Unity xml configuration
r271 foreach(var item in Items) {
var serializer = new XmlSerializer(item.GetType());
serializer.Serialize(writer, item);
}
cin
Working on Unity xml configuration
r267 }
}
}