comparison Implab.ServiceHost/Unity/RegistrationBuilder.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 22629bf26121
children f07be402ab02
comparison
equal deleted inserted replaced
276:b4e0f81c7425 277:963b17c275be
3 using System.ComponentModel; 3 using System.ComponentModel;
4 using System.Linq; 4 using System.Linq;
5 using System.Xml.Serialization; 5 using System.Xml.Serialization;
6 using Implab.Xml; 6 using Implab.Xml;
7 using Unity.Injection; 7 using Unity.Injection;
8 using Unity.Lifetime;
8 using Unity.Registration; 9 using Unity.Registration;
9 10
10 namespace Implab.ServiceHost.Unity { 11 namespace Implab.ServiceHost.Unity {
12 /// <summary>
13 /// Базовый класс для формирования записей в контейнере, созволяет указать время жизни для записи
14 /// </summary>
11 public abstract class RegistrationBuilder { 15 public abstract class RegistrationBuilder {
12 public Type RegistrationType { 16 public Type RegistrationType {
13 get; 17 get;
14 private set; 18 private set;
15 } 19 }
16 20
21 internal LifetimeManager Lifetime { get; set; }
22
17 protected RegistrationBuilder(Type registrationType) { 23 protected RegistrationBuilder(Type registrationType) {
18 RegistrationType = registrationType; 24 RegistrationType = registrationType;
19 } 25 }
26
27 internal void Visit(SingletonLifetimeElement simgletonLifetime) {
28 Lifetime = new SingletonLifetimeManager();
29 }
30
31 internal void Visit(ContainerLifetimeElement containerLifetime) {
32 Lifetime = new ContainerControlledLifetimeManager();
33 }
34
35 internal void Visit(HierarchicalLifetimeElement hierarchicalLifetime) {
36 Lifetime = new HierarchicalLifetimeManager();
37 }
38
39 internal void Visist(ContextLifetimeElement contextLifetime) {
40 Lifetime = new PerResolveLifetimeManager();
41 }
20 } 42 }
21 } 43 }