view Implab.ServiceHost/Unity/RegisterElement.cs @ 269:ff581cff7003 v3

Working on Unity container xml configuration
author cin
date Tue, 24 Apr 2018 01:46:02 +0300
parents
children ade80d94dfb5
line wrap: on
line source

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

namespace Implab.ServiceHost.Unity {

    [XmlRoot("register", Namespace = Schema.ContainerConfigurationNamespace)]
    public class RegisterElement : AbstractRegistration  {
        
        /// <summary>
        /// An optional type specification for the service registration, 
        /// must be assignable from the type specified by <see cref="ImplementedType"/>
        /// </summary>
        [XmlAttribute("provides")]
        public string ProvidesType { get; set; }

        /// <summary>
        /// The type which is registered as a service in the container.
        /// </summary>
        [XmlAttribute("type")]
        public string ImplementedType { get; set; }

        [XmlElement("signleton", typeof(SimgletonLifetimeElement))]
        [XmlElement("context", typeof(ContextLifetimeElement))]
        [XmlElement("container", typeof(ContainerLifetimeElement))]
        [XmlElement("hierarchy", typeof(HierarchicalLifetimeElement))]
        public LifetimeElement Lifetime {get; set;}

        [XmlElement("constructor", typeof(ConstructorInjectorElement))]
        [XmlElement("property", typeof(PropertyInjectorElement))]
        [XmlElement("method", typeof(MethodInjectorElement))]
        public AbstractInjectorElement[] Injectors { get; set; }
    }
    
}