RegistrationBuilder.cs
42 lines
| 1.3 KiB
| text/x-csharp
|
CSharpLexer
|
|
r274 | using System; | |
| using System.Collections.Generic; | |||
| using System.ComponentModel; | |||
| using System.Linq; | |||
| using System.Xml.Serialization; | |||
| using Implab.Xml; | |||
| using Unity.Injection; | |||
|
|
r277 | using Unity.Lifetime; | |
|
|
r274 | using Unity.Registration; | |
| namespace Implab.ServiceHost.Unity { | |||
|
|
r277 | /// <summary> | |
| /// Базовый класс для формирования записей в контейнере, созволяет указать время жизни для записи | |||
| /// </summary> | |||
|
|
r274 | public abstract class RegistrationBuilder { | |
| public Type RegistrationType { | |||
| get; | |||
| private set; | |||
| } | |||
|
|
r277 | internal LifetimeManager Lifetime { get; set; } | |
|
|
r274 | protected RegistrationBuilder(Type registrationType) { | |
| RegistrationType = registrationType; | |||
| } | |||
|
|
r277 | ||
| internal void Visit(SingletonLifetimeElement simgletonLifetime) { | |||
| Lifetime = new SingletonLifetimeManager(); | |||
| } | |||
| internal void Visit(ContainerLifetimeElement containerLifetime) { | |||
| Lifetime = new ContainerControlledLifetimeManager(); | |||
| } | |||
| internal void Visit(HierarchicalLifetimeElement hierarchicalLifetime) { | |||
| Lifetime = new HierarchicalLifetimeManager(); | |||
| } | |||
| internal void Visist(ContextLifetimeElement contextLifetime) { | |||
| Lifetime = new PerResolveLifetimeManager(); | |||
| } | |||
|
|
r274 | } | |
| } |
