annotate Implab.ServiceHost/Unity/AbstractRegistration.cs @ 278:6691aff01de1 v3

Implab: added XmlDefaultSeializer (SerializersPool is now obsolete) Implab.ServiceHost: rewritten TypeReference (added support for nested types), stable API
author cin
date Thu, 03 May 2018 09:59:44 +0300
parents 963b17c275be
children 8714471e8d78
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
269
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
1 using System;
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
2 using System.Xml.Serialization;
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
3 using Unity.Lifetime;
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
4 using Unity.Registration;
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
5
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
6 namespace Implab.ServiceHost.Unity
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
7 {
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
8 /// <summary>
963b17c275be Refactoring
cin
parents: 274
diff changeset
9 /// Базовая информаци о регистрации в контейнере: тип, имя и время жизни
963b17c275be Refactoring
cin
parents: 274
diff changeset
10 /// </summary>
963b17c275be Refactoring
cin
parents: 274
diff changeset
11 public abstract class AbstractRegistration : AbstractContainerItem {
269
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
12
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
13 /// <summary>
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
14 /// An optional name for a registration in the container
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
15 /// </summary>
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
16 [XmlAttribute("name")]
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
17 public string Name {
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
18 get; set;
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
19 }
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
20
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
21 [XmlElement("signleton", typeof(SingletonLifetimeElement))]
271
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
22 [XmlElement("context", typeof(ContextLifetimeElement))]
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
23 [XmlElement("container", typeof(ContainerLifetimeElement))]
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
24 [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))]
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
25 public LifetimeElement Lifetime {get; set;}
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
26
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
27 /// <summary>
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
28 /// A type specification for the service registration,
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
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
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
32
277
963b17c275be Refactoring
cin
parents: 274
diff changeset
33 public virtual Type GetRegistrationType(Func<string,Type> resolver) {
963b17c275be Refactoring
cin
parents: 274
diff changeset
34 return resolver(RegistrationType);
963b17c275be Refactoring
cin
parents: 274
diff changeset
35 }
963b17c275be Refactoring
cin
parents: 274
diff changeset
36
963b17c275be Refactoring
cin
parents: 274
diff changeset
37 public virtual void Visit(RegistrationBuilder builder) {
963b17c275be Refactoring
cin
parents: 274
diff changeset
38 Lifetime?.Visit(builder);
963b17c275be Refactoring
cin
parents: 274
diff changeset
39 }
963b17c275be Refactoring
cin
parents: 274
diff changeset
40
269
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
41 }
ff581cff7003 Working on Unity container xml configuration
cin
parents:
diff changeset
42 }