using System;
using System.Xml;

namespace FluentNHibernate.Mapping
{
    public class ImportPart : IMappingPart
    {
        private readonly Cache<string, string> attributes = new Cache<string, string>();
        private readonly Type importType;

        public ImportPart(Type importType)
        {
            this.importType = importType;
        }

        public void SetAttribute(string name, string value)
        {
            attributes.Store(name, value);
        }

        public void SetAttributes(Attributes attrs)
        {
            foreach (var key in attrs.Keys)
            {
                SetAttribute(key, attrs[key]);
            }
        }

        public void Write(XmlElement classElement, IMappingVisitor visitor)
        {
            var importElement = classElement.AddElement("import")
                .WithAtt("class", importType.AssemblyQualifiedName);

            attributes.ForEachPair((name, value) => importElement.WithAtt(name, value));
        }

        public void As(string alternativeName)
        {
            SetAttribute("rename", alternativeName);
        }

        public int Level
        {
            get { return 1; }
        }

        public PartPosition Position
        {
            get { return PartPosition.First; }
        }
    }
}
using System;
using System.Xml;

namespace FluentNHibernate.Mapping
{
    public class ImportPart : IMappingPart
    {
        private readonly Cache<string, string> attributes = new Cache<string, string>();
        private readonly Type importType;

        public ImportPart(Type importType)
        {
            this.importType = importType;
        }

        public void SetAttribute(string name, string value)
        {
            attributes.Store(name, value);
        }

        public void SetAttributes(Attributes attrs)
        {
            foreach (var key in attrs.Keys)
            {
                SetAttribute(key, attrs[key]);
            }
        }

        public void Write(XmlElement classElement, IMappingVisitor visitor)
        {
            var importElement = classElement.AddElement("import")
                .WithAtt("class", importType.AssemblyQualifiedName)
                .WithAtt("xmlns", "urn:nhibernate-mapping-2.2");

            attributes.ForEachPair((name, value) => importElement.WithAtt(name, value));
        }

        public void As(string alternativeName)
        {
            SetAttribute("rename", alternativeName);
        }

        public int Level
        {
            get { return 1; }
        }

        public PartPosition Position
        {
            get { return PartPosition.First; }
        }
    }
}
Fix import tag to have correct namespace
Fix import tag to have correct namespace


git-svn-id: a161142445158cf41e00e2afdd70bb78aded5464@138 48f0ce17-cc52-0410-af8c-857c09b6549b
