當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlTypeMapping.SetKeyInternal方法代碼示例

本文整理匯總了C#中System.Xml.Serialization.XmlTypeMapping.SetKeyInternal方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlTypeMapping.SetKeyInternal方法的具體用法?C# XmlTypeMapping.SetKeyInternal怎麽用?C# XmlTypeMapping.SetKeyInternal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.Serialization.XmlTypeMapping的用法示例。


在下文中一共展示了XmlTypeMapping.SetKeyInternal方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetKnownMapping

 private static XmlTypeMapping GetKnownMapping(Type type, string ns)
 {
     if (ns != null && ns != string.Empty)
         return null;
     TypeDesc typeDesc;
     if (!TypeScope.PrimtiveTypes.TryGetValue(type, out typeDesc))
         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;
 }
開發者ID:SamuelEnglard,項目名稱:corefx,代碼行數:13,代碼來源:XmlSerializer.cs

示例2: ImportTypeMapping

 /// <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));
     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;
 }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:17,代碼來源:soapreflectionimporter.cs

示例3: GetTopLevelMapping

        // will create a shallow type mapping for a top-level type
        internal static XmlTypeMapping GetTopLevelMapping(Type type, string defaultNamespace) {
            XmlAttributes a = new XmlAttributes(type);
            TypeDesc typeDesc = new TypeScope().GetTypeDesc(type);
            ElementAccessor element = new ElementAccessor();

            if (typeDesc.Kind == TypeKind.Node) {
                element.Any = true;
            }
            else {
                string ns = a.XmlRoot == null ? defaultNamespace : a.XmlRoot.Namespace;
                string typeName = string.Empty;
                if (a.XmlType != null)
                    typeName = a.XmlType.TypeName;
                if (typeName.Length == 0) 
                    typeName = type.Name;

                element.Name = XmlConvert.EncodeLocalName(typeName);
                element.Namespace = ns;
            }
            XmlTypeMapping mapping = new XmlTypeMapping(null, element);
            mapping.SetKeyInternal(XmlMapping.GenerateKey(type, a.XmlRoot, defaultNamespace));
            return mapping;
        }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:24,代碼來源:xmlreflectionimporter.cs

示例4: ImportTypeMapping

 /// <include file='doc\XmlReflectionImporter.uex' path='docs/doc[@for="XmlReflectionImporter.ImportTypeMapping3"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute root, string defaultNamespace) {
     if (type == null)
         throw new ArgumentNullException("type");
     XmlTypeMapping xmlMapping = new XmlTypeMapping(typeScope, ImportElement(modelScope.GetTypeModel(type), root, defaultNamespace));
     xmlMapping.SetKeyInternal(XmlMapping.GenerateKey(type, root, defaultNamespace));
     xmlMapping.GenerateSerializer = true;
     return xmlMapping;
 }
開發者ID:gbarnett,項目名稱:shared-source-cli-2.0,代碼行數:12,代碼來源:xmlreflectionimporter.cs

示例5: GetKnownMapping

 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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:18,代碼來源:XmlSerializer.cs

示例6: GetTopLevelMapping

 internal static XmlTypeMapping GetTopLevelMapping(Type type, string defaultNamespace)
 {
     XmlAttributes attributes = new XmlAttributes(type);
     TypeDesc typeDesc = new TypeScope().GetTypeDesc(type);
     ElementAccessor accessor = new ElementAccessor();
     if (typeDesc.Kind == TypeKind.Node)
     {
         accessor.Any = true;
     }
     else
     {
         string str = (attributes.XmlRoot == null) ? defaultNamespace : attributes.XmlRoot.Namespace;
         string name = string.Empty;
         if (attributes.XmlType != null)
         {
             name = attributes.XmlType.TypeName;
         }
         if (name.Length == 0)
         {
             name = type.Name;
         }
         accessor.Name = XmlConvert.EncodeLocalName(name);
         accessor.Namespace = str;
     }
     XmlTypeMapping mapping = new XmlTypeMapping(null, accessor);
     mapping.SetKeyInternal(XmlMapping.GenerateKey(type, attributes.XmlRoot, defaultNamespace));
     return mapping;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:28,代碼來源:XmlReflectionImporter.cs

示例7: ImportTypeMapping

 public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute root, string defaultNamespace)
 {
     if (type == null)
     {
         throw new ArgumentNullException("type");
     }
     XmlTypeMapping mapping = new XmlTypeMapping(this.typeScope, this.ImportElement(this.modelScope.GetTypeModel(type), root, defaultNamespace, new RecursionLimiter()));
     mapping.SetKeyInternal(XmlMapping.GenerateKey(type, root, defaultNamespace));
     mapping.GenerateSerializer = true;
     return mapping;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:11,代碼來源:XmlReflectionImporter.cs


注:本文中的System.Xml.Serialization.XmlTypeMapping.SetKeyInternal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。