Mercurial > pub > ImplabNet
annotate Implab.ServiceHost/Unity/AbstractRegistration.cs @ 280:f07be402ab02 v3
Added Trace<T>.Debug(...) method for debug messages
Added ContainerBuilde.LoadConfig(Uri) method
author | cin |
---|---|
date | Fri, 25 May 2018 19:15:26 +0300 |
parents | 8714471e8d78 |
children |
rev | line source |
---|---|
269 | 1 using System; |
2 using System.Xml.Serialization; | |
3 using Unity.Lifetime; | |
4 using Unity.Registration; | |
5 | |
6 namespace Implab.ServiceHost.Unity | |
7 { | |
277 | 8 /// <summary> |
9 /// Базовая информаци о регистрации в контейнере: тип, имя и время жизни | |
10 /// </summary> | |
279 | 11 public abstract class AbstractRegistration : AbstractContainerItem, IRegistration { |
269 | 12 |
13 /// <summary> | |
14 /// An optional name for a registration in the container | |
15 /// </summary> | |
16 [XmlAttribute("name")] | |
17 public string Name { | |
18 get; set; | |
19 } | |
20 | |
277 | 21 [XmlElement("signleton", typeof(SingletonLifetimeElement))] |
271 | 22 [XmlElement("context", typeof(ContextLifetimeElement))] |
23 [XmlElement("container", typeof(ContainerLifetimeElement))] | |
24 [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))] | |
25 public LifetimeElement Lifetime {get; set;} | |
26 | |
27 /// <summary> | |
28 /// A type specification for the service registration, | |
29 /// </summary> | |
273
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
30 [XmlAttribute("type")] |
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
31 public string RegistrationType { get; set; } |
271 | 32 |
279 | 33 public virtual LifetimeManager GetLifetime(ContainerBuilder builder) { |
34 return Lifetime?.GetLifetime(builder); | |
35 } | |
36 | |
277 | 37 public virtual Type GetRegistrationType(Func<string,Type> resolver) { |
38 return resolver(RegistrationType); | |
39 } | |
40 | |
279 | 41 public virtual Type GetRegistrationType(ContainerBuilder builder) { |
42 return builder.ResolveType(RegistrationType); | |
277 | 43 } |
44 | |
279 | 45 |
46 | |
269 | 47 } |
48 } |