view Implab.ServiceHost/Unity/AbstractRegistration.cs @ 272:9d1cca834b05 v3

preview version of Unity xml configuration
author cin
date Thu, 26 Apr 2018 03:14:54 +0300
parents d4d437ec4483
children 79110a16cab7
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 abstract void Visit(ConfigurationContext context);
    }
}