comparison Implab.ServiceHost/Unity/AbstractRegistration.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 8714471e8d78
comparison
equal deleted inserted replaced
276:b4e0f81c7425 277:963b17c275be
3 using Unity.Lifetime; 3 using Unity.Lifetime;
4 using Unity.Registration; 4 using Unity.Registration;
5 5
6 namespace Implab.ServiceHost.Unity 6 namespace Implab.ServiceHost.Unity
7 { 7 {
8 public abstract class AbstractRegistration : ContainerItemElement { 8 /// <summary>
9 /// Базовая информаци о регистрации в контейнере: тип, имя и время жизни
10 /// </summary>
11 public abstract class AbstractRegistration : AbstractContainerItem {
9 12
10 /// <summary> 13 /// <summary>
11 /// An optional name for a registration in the container 14 /// An optional name for a registration in the container
12 /// </summary> 15 /// </summary>
13 [XmlAttribute("name")] 16 [XmlAttribute("name")]
14 public string Name { 17 public string Name {
15 get; set; 18 get; set;
16 } 19 }
17 20
18 [XmlElement("signleton", typeof(SimgletonLifetimeElement))] 21 [XmlElement("signleton", typeof(SingletonLifetimeElement))]
19 [XmlElement("context", typeof(ContextLifetimeElement))] 22 [XmlElement("context", typeof(ContextLifetimeElement))]
20 [XmlElement("container", typeof(ContainerLifetimeElement))] 23 [XmlElement("container", typeof(ContainerLifetimeElement))]
21 [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))] 24 [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))]
22 public LifetimeElement Lifetime {get; set;} 25 public LifetimeElement Lifetime {get; set;}
23 26
25 /// A type specification for the service registration, 28 /// A type specification for the service registration,
26 /// </summary> 29 /// </summary>
27 [XmlAttribute("type")] 30 [XmlAttribute("type")]
28 public string RegistrationType { get; set; } 31 public string RegistrationType { get; set; }
29 32
33 public virtual Type GetRegistrationType(Func<string,Type> resolver) {
34 return resolver(RegistrationType);
35 }
36
37 public virtual void Visit(RegistrationBuilder builder) {
38 Lifetime?.Visit(builder);
39 }
40
30 } 41 }
31 } 42 }