Mercurial > pub > ImplabNet
comparison Implab.ServiceHost/Unity/TypeRegistrationBuilder.cs @ 278:6691aff01de1 v3
Implab: added XmlDefaultSeializer (SerializersPool is now obsolete)
Implab.ServiceHost: rewritten TypeReference (added support for nested types), stable API
author | cin |
---|---|
date | Thu, 03 May 2018 09:59:44 +0300 |
parents | 963b17c275be |
children | 8714471e8d78 |
comparison
equal
deleted
inserted
replaced
277:963b17c275be | 278:6691aff01de1 |
---|---|
35 internal void Visit(ConstructorInjectionElement constructorInjection) { | 35 internal void Visit(ConstructorInjectionElement constructorInjection) { |
36 | 36 |
37 | 37 |
38 var parameters = constructorInjection.Parameters? | 38 var parameters = constructorInjection.Parameters? |
39 .Select(x => { | 39 .Select(x => { |
40 var valueBuilder = new InjectionValueBuilder(m_resolver, null); | 40 var valueBuilder = new InjectionParameterBuilder(m_resolver, null); |
41 x.Visit(valueBuilder); | 41 x.Visit(valueBuilder); |
42 return valueBuilder.Injection; | 42 return valueBuilder.Injection; |
43 }) | 43 }) |
44 .ToArray(); | 44 .ToArray(); |
45 | 45 |
46 var injection = parameters != null ? new InjectionConstructor(parameters) : new InjectionConstructor(); | 46 var injection = parameters != null ? new InjectionConstructor(parameters) : new InjectionConstructor(); |
47 m_injections.Add(injection); | 47 m_injections.Add(injection); |
48 } | 48 } |
49 | 49 |
50 internal void Visit(MethodInjectionElement methodInjection) { | 50 internal void Visit(MethodInjectionElement methodInjection) { |
51 var valueContext = new InjectionValueBuilder(m_resolver, null); | |
52 | |
53 var parameters = methodInjection.Parameters? | 51 var parameters = methodInjection.Parameters? |
54 .Select(x => { | 52 .Select(x => { |
55 var valueBuilder = new InjectionValueBuilder(m_resolver, null); | 53 var valueBuilder = new InjectionParameterBuilder(m_resolver, null); |
56 x.Visit(valueBuilder); | 54 x.Visit(valueBuilder); |
57 return valueBuilder.Injection; | 55 return valueBuilder.Injection; |
58 }) | 56 }) |
59 .ToArray(); | 57 .ToArray(); |
60 | 58 |
64 | 62 |
65 internal void Visit(PropertyInjectionElement propertyInjection) { | 63 internal void Visit(PropertyInjectionElement propertyInjection) { |
66 if (propertyInjection.Value == null) | 64 if (propertyInjection.Value == null) |
67 throw new Exception($"A value value must be specified for the property '{propertyInjection.Name}'"); | 65 throw new Exception($"A value value must be specified for the property '{propertyInjection.Name}'"); |
68 | 66 |
69 var propertyType = RegistrationType.GetProperty(propertyInjection.Name)?.PropertyType; | 67 var propertyType = ImplementationType.GetProperty(propertyInjection.Name)?.PropertyType; |
70 var valueContext = new InjectionValueBuilder(m_resolver, propertyType); | 68 var valueContext = new InjectionParameterBuilder(m_resolver, propertyType); |
71 | 69 |
72 propertyInjection.Value.Visit(valueContext); | 70 propertyInjection.Value.Visit(valueContext); |
73 var injection = new InjectionProperty(propertyInjection.Name, valueContext.Injection); | 71 var injection = new InjectionProperty(propertyInjection.Name, valueContext.Injection); |
74 m_injections.Add(injection); | 72 m_injections.Add(injection); |
75 } | 73 } |