comparison Implab.ServiceHost/Unity/FactoryActivator.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
children 8714471e8d78
comparison
equal deleted inserted replaced
277:963b17c275be 278:6691aff01de1
1 using System;
2
3 namespace Implab.ServiceHost.Unity {
4 public class FactoryActivator : FactoryAbstractRegistratrion {
5
6 public Type FactoryType { get; set; }
7
8 public string FactoryName { get; set; }
9
10 public new Type RegistrationType { get; set; }
11
12 public override void Visit(FactoryRegistrationBuilder builder) {
13 base.Visit(builder);
14
15 builder.GetType()
16 .GetMethod(
17 nameof(FactoryRegistrationBuilder.SetFactoryDependency)
18 , new[] { typeof(string) }
19 )
20 .MakeGenericMethod(FactoryType, RegistrationType)
21 .Invoke(builder, new[] { FactoryName });
22 }
23
24 public override Type GetRegistrationType(Func<string, Type> resolver) {
25 return RegistrationType;
26 }
27
28 }
29 }