annotate Implab.ServiceHost/Unity/RegistrationBuilder.cs @ 279:8714471e8d78 v3

Container configuration cleanup, RC2
author cin
date Fri, 04 May 2018 18:12:42 +0300
parents 963b17c275be
children f07be402ab02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
274
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
1 using System;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
2 using System.Collections.Generic;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
3 using System.ComponentModel;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
4 using System.Linq;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
5 using System.Xml.Serialization;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
6 using Implab.Xml;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
7 using Unity.Injection;
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
8 using Unity.Lifetime;
274
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
9 using Unity.Registration;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
10
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
11 namespace Implab.ServiceHost.Unity {
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
12 /// <summary>
963b17c275be Refactoring
cin
parents: 274
diff changeset
13 /// Базовый класс для формирования записей в контейнере, созволяет указать время жизни для записи
963b17c275be Refactoring
cin
parents: 274
diff changeset
14 /// </summary>
274
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
15 public abstract class RegistrationBuilder {
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
16 public Type RegistrationType {
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
17 get;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
18 private set;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
19 }
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
20
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
21 internal LifetimeManager Lifetime { get; set; }
963b17c275be Refactoring
cin
parents: 274
diff changeset
22
274
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
23 protected RegistrationBuilder(Type registrationType) {
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
24 RegistrationType = registrationType;
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
25 }
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
26
963b17c275be Refactoring
cin
parents: 274
diff changeset
27 internal void Visit(SingletonLifetimeElement simgletonLifetime) {
963b17c275be Refactoring
cin
parents: 274
diff changeset
28 Lifetime = new SingletonLifetimeManager();
963b17c275be Refactoring
cin
parents: 274
diff changeset
29 }
963b17c275be Refactoring
cin
parents: 274
diff changeset
30
963b17c275be Refactoring
cin
parents: 274
diff changeset
31 internal void Visit(ContainerLifetimeElement containerLifetime) {
963b17c275be Refactoring
cin
parents: 274
diff changeset
32 Lifetime = new ContainerControlledLifetimeManager();
963b17c275be Refactoring
cin
parents: 274
diff changeset
33 }
963b17c275be Refactoring
cin
parents: 274
diff changeset
34
963b17c275be Refactoring
cin
parents: 274
diff changeset
35 internal void Visit(HierarchicalLifetimeElement hierarchicalLifetime) {
963b17c275be Refactoring
cin
parents: 274
diff changeset
36 Lifetime = new HierarchicalLifetimeManager();
963b17c275be Refactoring
cin
parents: 274
diff changeset
37 }
963b17c275be Refactoring
cin
parents: 274
diff changeset
38
963b17c275be Refactoring
cin
parents: 274
diff changeset
39 internal void Visist(ContextLifetimeElement contextLifetime) {
963b17c275be Refactoring
cin
parents: 274
diff changeset
40 Lifetime = new PerResolveLifetimeManager();
963b17c275be Refactoring
cin
parents: 274
diff changeset
41 }
274
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
42 }
22629bf26121 Unity xml configuration, alpha2
cin
parents:
diff changeset
43 }