267
|
1 using Implab.Xml;
|
|
2 using System.Collections.Generic;
|
|
3 using System.Xml;
|
|
4 using System.Xml.Schema;
|
|
5 using System.Xml.Serialization;
|
|
6
|
|
7 namespace Implab.ServiceHost.Unity {
|
|
8 [XmlRoot("container", Namespace = Schema.ContainerConfigurationNamespace)]
|
|
9 public class ContainerElement : IXmlSerializable {
|
|
10
|
270
|
11 public List<IConfigurationElement> Items {get; set; } = new List<IConfigurationElement>();
|
267
|
12
|
|
13 public XmlSchema GetSchema() {
|
|
14 return null;
|
|
15 }
|
|
16
|
|
17 public void ReadXml(XmlReader reader) {
|
|
18 while(reader.Read() && reader.NodeType != XmlNodeType.EndElement) {
|
269
|
19 var registration = ConfigurationSchema.Default.Deserialize<IConfigurationElement>(reader);
|
270
|
20 Items.Add(registration);
|
267
|
21 }
|
|
22 }
|
|
23
|
|
24 public void WriteXml(XmlWriter writer) {
|
271
|
25 foreach(var item in Items) {
|
|
26 var serializer = new XmlSerializer(item.GetType());
|
|
27 serializer.Serialize(writer, item);
|
|
28 }
|
267
|
29 }
|
|
30 }
|
|
31 } |