/// <include file='doc\SoapReflectionImporter.uex' path='docs/doc[@for="XmlReflectionImporter.ImportTypeMapping1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public XmlTypeMapping ImportTypeMapping(Type type, string defaultNamespace)
        {
            ElementAccessor element = new ElementAccessor();

            element.IsSoap    = true;
            element.Mapping   = ImportTypeMapping(_modelScope.GetTypeModel(type), new RecursionLimiter());
            element.Name      = element.Mapping.DefaultElementName;
            element.Namespace = element.Mapping.Namespace == null ? defaultNamespace : element.Mapping.Namespace;
            element.Form      = XmlSchemaForm.Qualified;
            XmlTypeMapping xmlMapping = new XmlTypeMapping(_typeScope, element);

            xmlMapping.SetKeyInternal(XmlMapping.GenerateKey(type, null, defaultNamespace));
            xmlMapping.IsSoap             = true;
            xmlMapping.GenerateSerializer = true;
            return(xmlMapping);
        }
Esempio n. 2
0
        private static XmlTypeMapping GetKnownMapping(Type type, string ns)
        {
            if (ns != null && ns != string.Empty)
            {
                return(null);
            }
            TypeDesc typeDesc = (TypeDesc)TypeScope.PrimtiveTypes[type];

            if (typeDesc == null)
            {
                return(null);
            }
            ElementAccessor element = new ElementAccessor();

            element.Name = typeDesc.DataType.Name;
            XmlTypeMapping mapping = new XmlTypeMapping(null, element);

            mapping.SetKeyInternal(XmlMapping.GenerateKey(type, null, null));
            return(mapping);
        }