diff Implab.ServiceHost/Unity/ContainerElement.cs @ 267:6b3e5c48131b v3

Working on Unity xml configuration
author cin
date Fri, 20 Apr 2018 19:05:12 +0300
parents
children ff581cff7003
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab.ServiceHost/Unity/ContainerElement.cs	Fri Apr 20 19:05:12 2018 +0300
@@ -0,0 +1,28 @@
+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 {
+
+        public List<ServiceElement> Registrations {get; set; } = new List<ServiceElement>();
+
+        public XmlSchema GetSchema() {
+            return null;
+        }
+
+        public void ReadXml(XmlReader reader) {
+            while(reader.Read() && reader.NodeType != XmlNodeType.EndElement) {
+                var registration = SerializationHelpers.Deserialize<ServiceElement>(reader);
+                Registrations.Add(registration);
+            }
+        }
+
+        public void WriteXml(XmlWriter writer) {
+            throw new System.NotImplementedException();
+        }
+    }
+}
\ No newline at end of file