本文整理汇总了C#中System.Xml.Serialization.XmlReflectionImporter.IncludeType方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReflectionImporter.IncludeType方法的具体用法?C# XmlReflectionImporter.IncludeType怎么用?C# XmlReflectionImporter.IncludeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Serialization.XmlReflectionImporter
的用法示例。
在下文中一共展示了XmlReflectionImporter.IncludeType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XmlSerializer
/// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.XmlSerializer"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace) {
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
for (int i = 0; i < extraTypes.Length; i++)
importer.IncludeType(extraTypes[i]);
tempAssembly = GenerateTempAssembly(importer.ImportTypeMapping(type, root));
this.events.sender = this;
}
示例2: GetLiteralTypeMapping
XmlTypeMapping GetLiteralTypeMapping ()
{
XmlRootAttribute root = new XmlRootAttribute("rootroot");
Type[] types = new Type[] {typeof(UknTestPart), typeof(AnotherTestPart), typeof(DblStringContainer) };
XmlReflectionImporter ri = new XmlReflectionImporter ();
foreach (Type t in types) ri.IncludeType (t);
return ri.ImportTypeMapping (typeof(Test), root);
}
示例3: TestIncludeType
[Test] // bug #76049
public void TestIncludeType ()
{
XmlReflectionImporter imp = new XmlReflectionImporter ();
XmlTypeMapping map = imp.ImportTypeMapping (typeof (object));
imp.IncludeType (typeof (TestSpace));
XmlSerializer ser = new XmlSerializer (map);
ser.Serialize (new StringWriter (), new TestSpace ());
}
示例4: Init
private void Init(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, object location, object evidence)
{
if (type == null)
throw new ArgumentNullException(nameof(type));
DefaultNamespace = defaultNamespace;
rootType = type;
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
if (extraTypes != null)
{
for (int i = 0; i < extraTypes.Length; i++)
importer.IncludeType(extraTypes[i]);
}
_mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
#if !NET_NATIVE
_tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace);
#endif
}
示例5: XmlSerializer
public XmlSerializer (Type type,
XmlAttributeOverrides overrides,
Type [] extraTypes,
XmlRootAttribute root,
string defaultNamespace)
{
if (type == null)
throw new ArgumentNullException ("type");
XmlReflectionImporter importer = new XmlReflectionImporter (overrides, defaultNamespace);
if (extraTypes != null)
{
foreach (Type intype in extraTypes)
importer.IncludeType (intype);
}
typeMapping = importer.ImportTypeMapping (type, root, defaultNamespace);
}
示例6: CreateSerializer
internal XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence)
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
if (location != null || evidence != null)
{
DemandForUserLocationOrEvidence();
}
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
for (int i = 0; i < extraTypes.Length; i++)
importer.IncludeType(extraTypes[i]);
XmlTypeMapping mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
TempAssembly tempAssembly = XmlSerializer.GenerateTempAssembly(mapping, type, defaultNamespace, location, evidence);
return (XmlSerializer)tempAssembly.Contract.TypedSerializers[mapping.Key];
}
示例7: XmlSerializer
/// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.XmlSerializer7"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
internal XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, object location, object evidence)
{
#if NET_NATIVE
throw new PlatformNotSupportedException();
#else
if (type == null)
throw new ArgumentNullException("type");
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
if (extraTypes != null)
{
for (int i = 0; i < extraTypes.Length; i++)
importer.IncludeType(extraTypes[i]);
}
_mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
_tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace);
#endif
}
示例8: GetSerializer
XmlSerializer GetSerializer (MessageBodyDescription desc)
{
if (bodySerializers.ContainsKey (desc))
return bodySerializers [desc];
int count = desc.Parts.Count + (HasReturnValue (desc) ? 1 : 0);
XmlReflectionMember [] members = new XmlReflectionMember [count];
int ind = 0;
if (HasReturnValue (desc))
members [ind++] = CreateReflectionMember (desc.ReturnValue, true);
foreach (MessagePartDescription partDesc in desc.Parts)
members [ind++] = CreateReflectionMember (partDesc, false);
XmlReflectionImporter xmlImporter = new XmlReflectionImporter ();
// Register known types into xmlImporter.
foreach (var type in OperationKnownTypes)
xmlImporter.IncludeType (type);
XmlMembersMapping [] partsMapping = new XmlMembersMapping [1];
partsMapping [0] = xmlImporter.ImportMembersMapping (desc.WrapperName, desc.WrapperNamespace, members, true);
bodySerializers [desc] = XmlSerializer.FromMappings (partsMapping) [0];
return bodySerializers [desc];
}
示例9: XmlSerializer
public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence) {
if (type == null)
throw new ArgumentNullException("type");
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
for (int i = 0; i < extraTypes.Length; i++)
importer.IncludeType(extraTypes[i]);
this.mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
tempAssembly = GenerateTempAssembly(this.mapping, type, defaultNamespace, location, evidence);
}
示例10: XmlSerializer
/// <include file='doc\XmlSerializer.uex' path='docs/doc[@for="XmlSerializer.XmlSerializer7"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
internal XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence)
{
if (type == null)
throw new ArgumentNullException(nameof(type));
DefaultNamespace = defaultNamespace;
rootType = type;
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
if (extraTypes != null)
{
for (int i = 0; i < extraTypes.Length; i++)
importer.IncludeType(extraTypes[i]);
}
_mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
if (location != null || evidence != null)
{
DemandForUserLocationOrEvidence();
}
#if !NET_NATIVE
_tempAssembly = GenerateTempAssembly(_mapping, type, defaultNamespace, location, evidence);
#endif
}
示例11: XmlSerializer
public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence)
{
this.events = new XmlDeserializationEvents();
if (type == null)
{
throw new ArgumentNullException("type");
}
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
if (extraTypes != null)
{
for (int i = 0; i < extraTypes.Length; i++)
{
importer.IncludeType(extraTypes[i]);
}
}
this.mapping = importer.ImportTypeMapping(type, root, defaultNamespace);
if (location != null)
{
this.DemandForUserLocation();
}
this.tempAssembly = GenerateTempAssembly(this.mapping, type, defaultNamespace, location, evidence);
}
示例12: CreateSerializer
public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location, Evidence evidence)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
XmlReflectionImporter importer = new XmlReflectionImporter(overrides, defaultNamespace);
for (int i = 0; i < extraTypes.Length; i++)
{
importer.IncludeType(extraTypes[i]);
}
XmlTypeMapping xmlMapping = importer.ImportTypeMapping(type, root, defaultNamespace);
return (XmlSerializer) XmlSerializer.GenerateTempAssembly(xmlMapping, type, defaultNamespace, location, evidence).Contract.TypedSerializers[xmlMapping.Key];
}