System.Xml.Serialization.XmlMapping.GenerateKey C# (CSharp) Method

GenerateKey() static private method

static private GenerateKey ( Type type, XmlRootAttribute root, string ns ) : string
type System.Type
root XmlRootAttribute
ns string
return string
        internal static string GenerateKey(Type type, XmlRootAttribute root, string ns) {
            if (root == null) {
                root = (XmlRootAttribute)XmlAttributes.GetAttr(type, typeof(XmlRootAttribute));
            }
            return type.FullName + ":" + (root == null ? String.Empty : root.Key) + ":" + (ns == null ? String.Empty : ns);
        }

Usage Example

Example #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);
        }
All Usage Examples Of System.Xml.Serialization.XmlMapping::GenerateKey