274
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3 using System.ComponentModel;
|
|
4 using System.Linq;
|
|
5 using System.Xml.Serialization;
|
|
6 using Implab.Xml;
|
|
7 using Unity.Injection;
|
277
|
8 using Unity.Lifetime;
|
274
|
9 using Unity.Registration;
|
|
10
|
|
11 namespace Implab.ServiceHost.Unity {
|
277
|
12 /// <summary>
|
|
13 /// Базовый класс для формирования записей в контейнере, созволяет указать время жизни для записи
|
|
14 /// </summary>
|
274
|
15 public abstract class RegistrationBuilder {
|
|
16 public Type RegistrationType {
|
|
17 get;
|
|
18 private set;
|
|
19 }
|
|
20
|
277
|
21 internal LifetimeManager Lifetime { get; set; }
|
|
22
|
274
|
23 protected RegistrationBuilder(Type registrationType) {
|
|
24 RegistrationType = registrationType;
|
|
25 }
|
277
|
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 }
|
274
|
42 }
|
|
43 } |