AbstractRegistration.cs
41 lines
| 1.3 KiB
| text/x-csharp
|
CSharpLexer
|
|
r269 | using System; | |
| using System.Xml.Serialization; | |||
| using Unity.Lifetime; | |||
| using Unity.Registration; | |||
| namespace Implab.ServiceHost.Unity | |||
| { | |||
|
|
r277 | /// <summary> | |
| /// Базовая информаци о регистрации в контейнере: тип, имя и время жизни | |||
| /// </summary> | |||
| public abstract class AbstractRegistration : AbstractContainerItem { | |||
|
|
r269 | ||
| /// <summary> | |||
| /// An optional name for a registration in the container | |||
| /// </summary> | |||
| [XmlAttribute("name")] | |||
| public string Name { | |||
| get; set; | |||
| } | |||
|
|
r277 | [XmlElement("signleton", typeof(SingletonLifetimeElement))] | |
|
|
r271 | [XmlElement("context", typeof(ContextLifetimeElement))] | |
| [XmlElement("container", typeof(ContainerLifetimeElement))] | |||
| [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))] | |||
| public LifetimeElement Lifetime {get; set;} | |||
| /// <summary> | |||
| /// A type specification for the service registration, | |||
| /// </summary> | |||
|
|
r273 | [XmlAttribute("type")] | |
| public string RegistrationType { get; set; } | |||
|
|
r271 | ||
|
|
r277 | public virtual Type GetRegistrationType(Func<string,Type> resolver) { | |
| return resolver(RegistrationType); | |||
| } | |||
| public virtual void Visit(RegistrationBuilder builder) { | |||
| Lifetime?.Visit(builder); | |||
| } | |||
|
|
r269 | } | |
| } |
