GenerateKey() static private method

static private GenerateKey ( Type type, XmlRootAttribute root, string ns ) : string
type System.Type
root XmlRootAttribute
ns string
return string
Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        internal XmlMembersMapping(TypeScope scope, ElementAccessor accessor, XmlMappingAccess access) : base(scope, accessor, access)
        {
            MembersMapping mapping = (MembersMapping)accessor.Mapping;
            StringBuilder  builder = new StringBuilder();

            builder.Append(":");
            this.mappings = new XmlMemberMapping[mapping.Members.Length];
            for (int i = 0; i < this.mappings.Length; i++)
            {
                if (mapping.Members[i].TypeDesc.Type != null)
                {
                    builder.Append(XmlMapping.GenerateKey(mapping.Members[i].TypeDesc.Type, null, null));
                    builder.Append(":");
                }
                this.mappings[i] = new XmlMemberMapping(mapping.Members[i]);
            }
            base.SetKeyInternal(builder.ToString());
        }
Ejemplo n.º 3
0
        public XmlTypeMapping ImportTypeMapping(Type type, string defaultNamespace)
        {
            ElementAccessor accessor;

            accessor = new ElementAccessor {
                IsSoap    = true,
                Mapping   = this.ImportTypeMapping(this.modelScope.GetTypeModel(type), new RecursionLimiter()),
                Name      = accessor.Mapping.DefaultElementName,
                Namespace = (accessor.Mapping.Namespace == null) ? defaultNamespace : accessor.Mapping.Namespace,
                Form      = XmlSchemaForm.Qualified
            };
            XmlTypeMapping mapping = new XmlTypeMapping(this.typeScope, accessor);

            mapping.SetKeyInternal(XmlMapping.GenerateKey(type, null, defaultNamespace));
            mapping.IsSoap             = true;
            mapping.GenerateSerializer = true;
            return(mapping);
        }
        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);
        }
        private static XmlTypeMapping GetKnownMapping(Type type, string ns)
        {
            if ((ns != null) && (ns != string.Empty))
            {
                return(null);
            }
            TypeDesc desc = (TypeDesc)TypeScope.PrimtiveTypes[type];

            if (desc == null)
            {
                return(null);
            }
            ElementAccessor accessor = new ElementAccessor {
                Name = desc.DataType.Name
            };
            XmlTypeMapping mapping = new XmlTypeMapping(null, accessor);

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