##// END OF EJS Templates
refactoring
cin -
r275:6fefd5811b9b v3
parent child
Show More
@@ -0,0 +1,12
1 using System.Collections.Generic;
2
3 namespace Implab.ServiceHost.Unity
4 {
5 public interface IArrayInjectionParameter {
6
7 string TypeName { get; }
8
9 IEnumerable<IInjectionParameter> Items { get; }
10
11 }
12 } No newline at end of file
@@ -0,0 +1,5
1 namespace Implab.ServiceHost.Unity {
2 public interface IInjectionParameter {
3 void Visit(InjectionValueBuilder builder);
4 }
5 } No newline at end of file
@@ -1,12 +1,12
1 1 namespace Implab.ServiceHost.Unity
2 2 {
3 3 public class DefaultParameterElement : InjectionParameterElement, ITextValue {
4 4 public string Value {
5 5 get { return null; }
6 6 }
7 7
8 internal override void Visit(InjectionValueBuilder builder) {
8 public override void Visit(InjectionValueBuilder builder) {
9 9 builder.Visit(this);
10 10 }
11 11 }
12 12 } No newline at end of file
@@ -1,16 +1,16
1 1 using System.Xml.Serialization;
2 2
3 3 namespace Implab.ServiceHost.Unity {
4 4 public class DependencyParameterElement : InjectionParameterElement, IDependencyReference {
5 5
6 6 [XmlAttribute("name")]
7 7 public string DependencyName { get; set; }
8 8
9 9 [XmlAttribute("optional")]
10 10 public bool Optional { get; set; }
11 11
12 internal override void Visit(InjectionValueBuilder builder) {
12 public override void Visit(InjectionValueBuilder builder) {
13 13 builder.Visit(this);
14 14 }
15 15 }
16 16 } No newline at end of file
@@ -1,8 +1,10
1 1 namespace Implab.ServiceHost.Unity {
2 2 public interface IDependencyReference {
3 3
4 string TypeName { get; set; }
4 string TypeName { get; }
5 5
6 string DependencyName { get; set; }
6 bool Optional { get; }
7
8 string DependencyName { get; }
7 9 }
8 10 } No newline at end of file
@@ -1,8 +1,9
1 1 namespace Implab.ServiceHost.Unity {
2 2 public interface ITextValue {
3
3 4 string TypeName { get; }
4 5
5 6 string Value { get; }
6 7
7 8 }
8 9 } No newline at end of file
@@ -1,12 +1,12
1 1 using System;
2 2 using System.Xml.Serialization;
3 3
4 4 namespace Implab.ServiceHost.Unity {
5 public abstract class InjectionParameterElement {
5 public abstract class InjectionParameterElement : IInjectionParameter {
6 6
7 7 [XmlAttribute("type")]
8 8 public string TypeName { get; set; }
9 9
10 internal abstract void Visit(InjectionValueBuilder builder);
10 public abstract void Visit(InjectionValueBuilder builder);
11 11 }
12 12 } No newline at end of file
@@ -1,37 +1,43
1 1 using System;
2 2 using System.Xml;
3 3 using System.Xml.Serialization;
4 4
5 5 namespace Implab.ServiceHost.Unity
6 6 {
7 7 public class SerializedElement : AbstractRegistration, ISerializedValue {
8 8 [XmlAttribute("href")]
9 9 public string Location { get; set; }
10 10
11 11 [XmlAttribute("serializedType")]
12 12 public string SerializedType { get; set; }
13 13
14 14
15 15 [XmlAnyElement]
16 16 public XmlElement[] Content { get; set; }
17 17
18 18 string ISerializedValue.TypeName {
19 19 get {
20 20 return string.IsNullOrEmpty(SerializedType) ? RegistrationType : SerializedType;
21 21 }
22 22 }
23 23
24 public string TypeName => throw new NotImplementedException();
25
24 26 public override void Visit(ContainerBuilder context) {
25 27 context.Visit(this);
26 28 }
27 29
28 30 public XmlReader GetReader() {
29 31 if (!string.IsNullOrEmpty(Location))
30 32 return XmlReader.Create(Location);
31 33 if (Content != null && Content.Length > 0)
32 34 return Content[0].CreateNavigator().ReadSubtree();
33 35
34 36 throw new Exception("No content found, expected XML document");
35 37 }
38
39 public void Visit(InjectionValueBuilder builder) {
40 throw new NotImplementedException();
41 }
36 42 }
37 43 } No newline at end of file
@@ -1,28 +1,28
1 1 using System;
2 2 using System.Xml;
3 3 using System.Xml.Schema;
4 4 using System.Xml.Serialization;
5 5
6 6 namespace Implab.ServiceHost.Unity
7 7 {
8 8 public class SerializedParameterElement : InjectionParameterElement, ISerializedValue {
9 9 [XmlAttribute("href")]
10 10 public string Location { get; set; }
11 11
12 12 [XmlAnyElement]
13 13 public XmlElement[] Content { get; set; }
14 14
15 15 public XmlReader GetReader() {
16 16 if (!string.IsNullOrEmpty(Location))
17 17 return XmlReader.Create(Location);
18 18 if (Content != null && Content.Length > 0)
19 19 return Content[0].CreateNavigator().ReadSubtree();
20 20
21 21 throw new Exception("No content found, expected XML document");
22 22 }
23 23
24 internal override void Visit(InjectionValueBuilder builder) {
24 public override void Visit(InjectionValueBuilder builder) {
25 25 builder.Visit(this);
26 26 }
27 27 }
28 28 } No newline at end of file
@@ -1,13 +1,13
1 1 using System.Xml.Serialization;
2 2
3 3 namespace Implab.ServiceHost.Unity {
4 4 public class ValueParameterElement : InjectionParameterElement, ITextValue {
5 5 [XmlText]
6 6 [XmlAttribute("value")]
7 7 public string Value { get; set; }
8 8
9 internal override void Visit(InjectionValueBuilder builder) {
9 public override void Visit(InjectionValueBuilder builder) {
10 10 builder.Visit(this);
11 11 }
12 12 }
13 13 } No newline at end of file
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

ok, latest stable version should be in default

You need to be logged in to leave comments. Login now