diff Implab.ServiceHost/Unity/SerializedElement.cs @ 277:963b17c275be v3

Refactoring Added <array> element to injection parameters Working on registrations of factories
author cin
date Sat, 28 Apr 2018 18:48:09 +0300
parents 6fefd5811b9b
children 8714471e8d78
line wrap: on
line diff
--- a/Implab.ServiceHost/Unity/SerializedElement.cs	Sat Apr 28 00:11:38 2018 +0300
+++ b/Implab.ServiceHost/Unity/SerializedElement.cs	Sat Apr 28 18:48:09 2018 +0300
@@ -4,7 +4,7 @@
 
 namespace Implab.ServiceHost.Unity
 {
-    public class SerializedElement : AbstractRegistration, ISerializedValue {
+    public class SerializedElement : InstanceAbstractRegistration {
         [XmlAttribute("href")]
         public string Location { get; set; }
 
@@ -15,29 +15,15 @@
         [XmlAnyElement]
         public XmlElement[] Content { get; set; }
 
-        string ISerializedValue.TypeName {
-            get {
-                return string.IsNullOrEmpty(SerializedType) ? RegistrationType : SerializedType;
-            }
-        }
-
-        public string TypeName => throw new NotImplementedException();
-
-        public override void Visit(ContainerBuilder context) {
-            context.Visit(this);
-        }
+        public override void Visit(InstanceRegistrationBuilder builder) {
+            base.Visit(builder);
 
-        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");
-        }
-
-        public void Visit(InjectionValueBuilder builder) {
-            throw new NotImplementedException();
+            var parameter = new SerializedParameterElement {
+                TypeName = SerializedType,
+                Location = Location,
+                Content = Content
+            };
+            parameter.Visit(builder.ValueBuilder);
         }
     }
 }
\ No newline at end of file