comparison Implab.ServiceHost/Unity/TypeResolver.cs @ 272:9d1cca834b05 v3

preview version of Unity xml configuration
author cin
date Thu, 26 Apr 2018 03:14:54 +0300
parents ade80d94dfb5
children 963b17c275be
comparison
equal deleted inserted replaced
271:d4d437ec4483 272:9d1cca834b05
22 public TypeResolver() : this(null) { 22 public TypeResolver() : this(null) {
23 23
24 } 24 }
25 25
26 public TypeResolver(TypeResolver parent) { 26 public TypeResolver(TypeResolver parent) {
27 m_parent = parent;
27 m_insertAt = new LinkedListNode<string>(string.Empty); 28 m_insertAt = new LinkedListNode<string>(string.Empty);
28 m_namespases.AddFirst(m_insertAt); 29 m_namespases.AddFirst(m_insertAt);
29 } 30 }
30 31
31 public void AddNamespace(string ns) { 32 public void AddNamespace(string ns) {
54 throw new Exception($"Failed to resolve {reference}"); 55 throw new Exception($"Failed to resolve {reference}");
55 m_cache[reference.ToString()] = resolved; 56 m_cache[reference.ToString()] = resolved;
56 } 57 }
57 58
58 return resolved; 59 return resolved;
60 }
61
62 public Type Resolve(string typeSpec) {
63 return Resolve(TypeReference.Parse(typeSpec));
59 } 64 }
60 65
61 Type ResolveInternal(TypeReference reference, Type[] args, int argc) { 66 Type ResolveInternal(TypeReference reference, Type[] args, int argc) {
62 var resolved = ProbeInNamespaces( 67 var resolved = ProbeInNamespaces(
63 String.Join(".", new [] { reference.Namespace, reference.TypeName }.Where(x => !string.IsNullOrEmpty(x)) ), 68 String.Join(".", new [] { reference.Namespace, reference.TypeName }.Where(x => !string.IsNullOrEmpty(x)) ),