Mercurial > pub > ImplabNet
annotate Implab.ServiceHost/Unity/AbstractRegistration.cs @ 273:79110a16cab7 v3
Working on Unity xml configuration: Refactoring in progress
author | cin |
---|---|
date | Thu, 26 Apr 2018 19:35:01 +0300 |
parents | 9d1cca834b05 |
children | 22629bf26121 |
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 { | |
273
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
8 public abstract class AbstractRegistration : ContainerItemElement { |
269 | 9 |
10 /// <summary> | |
11 /// An optional name for a registration in the container | |
12 /// </summary> | |
13 [XmlAttribute("name")] | |
14 public string Name { | |
15 get; set; | |
16 } | |
17 | |
271 | 18 [XmlElement("signleton", typeof(SimgletonLifetimeElement))] |
19 [XmlElement("context", typeof(ContextLifetimeElement))] | |
20 [XmlElement("container", typeof(ContainerLifetimeElement))] | |
21 [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))] | |
22 public LifetimeElement Lifetime {get; set;} | |
23 | |
24 /// <summary> | |
25 /// A type specification for the service registration, | |
26 /// </summary> | |
273
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
27 [XmlAttribute("type")] |
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
28 public string RegistrationType { get; set; } |
271 | 29 |
273
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
30 public virtual Type ResolveRegistrationType(ContainerContext ctx) { |
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
31 return ctx.Resolve(RegistrationType); |
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
32 } |
79110a16cab7
Working on Unity xml configuration: Refactoring in progress
cin
parents:
272
diff
changeset
|
33 |
269 | 34 } |
35 } |