本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}