view Implab.ServiceHost/Unity/AbstractRegistration.cs @ 271:d4d437ec4483 v3

Working on Unity xml configuration
author cin
date Wed, 25 Apr 2018 19:23:35 +0300
parents ade80d94dfb5
children 9d1cca834b05
line wrap: on
line source

using System;
using System.Xml.Serialization;
using Unity.Lifetime;
using Unity.Registration;

namespace Implab.ServiceHost.Unity
{
    public abstract class AbstractRegistration : IConfigurationElement {

        /// <summary>
        /// An optional name for a registration in the container
        /// </summary>
        [XmlAttribute("name")]
        public string Name {
            get; set;
        }

        [XmlElement("signleton", typeof(SimgletonLifetimeElement))]
        [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>
        [XmlAttribute("provides")]
        public string ProvidesType { get; set; }

        public void Visit(ConfigurationContext context) {
            context.Visit(this);
        }
    }
}