本文整理汇总了C#中System.Xml.Serialization.XmlReflectionMember类的典型用法代码示例。如果您正苦于以下问题:C# XmlReflectionMember类的具体用法?C# XmlReflectionMember怎么用?C# XmlReflectionMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlReflectionMember类属于System.Xml.Serialization命名空间,在下文中一共展示了XmlReflectionMember类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ImportMembersMapping
public XmlMembersMapping ImportMembersMapping(string mappingName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool rpc)
{
Array membersObjects = _wrapperObject.InitializeArray(XmlMappingTypesHelper.XmlReflectionMemberType, members);
object[] parameters = new object[] { mappingName, ns, membersObjects, hasWrapperElement, rpc };
object o = _wrapperObject.CallMethod(s_importMembersMapping, parameters);
return new XmlMembersMapping(o);
}
开发者ID:weshaggard,项目名称:wcf,代码行数:8,代码来源:XmlMappingTypes.cs
示例2: CreateReflectionMember
private XmlReflectionMember CreateReflectionMember (MessagePartDescription partDesc, bool isReturnValue)
{
XmlReflectionMember m = new XmlReflectionMember ();
m.IsReturnValue = isReturnValue;
m.MemberName = partDesc.Name;
m.MemberType = partDesc.Type;
return m;
}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:XmlMessagesFormatter.cs
示例3: MembersMap
private XmlMembersMapping MembersMap (Type t, SoapAttributeOverrides overrides,
XmlReflectionMember [] members, bool inContainer, bool writeAccessors)
{
SoapReflectionImporter ri = new SoapReflectionImporter (overrides);
XmlMembersMapping mm = ri.ImportMembersMapping (null, null, members,
inContainer, writeAccessors);
return mm;
}
开发者ID:whereisaaron,项目名称:mono,代码行数:9,代码来源:SoapReflectionImporterTests.cs
示例4: CreateReflectionMember
private XmlReflectionMember CreateReflectionMember (MessagePartDescription partDesc, bool isReturnValue)
{
XmlReflectionMember m = new XmlReflectionMember ();
m.IsReturnValue = isReturnValue;
m.MemberName = partDesc.Name;
m.MemberType = partDesc.Type;
m.XmlAttributes = partDesc.MemberInfo == null ? new XmlAttributes () : new XmlAttributes (partDesc.MemberInfo);
return m;
}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:XmlMessagesFormatter.cs
示例5: ImportMembersMapping
public XmlMembersMapping ImportMembersMapping (string elementName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool writeAccessors, bool validate)
{
XmlMemberMapping[] mapping = new XmlMemberMapping[members.Length];
for (int n=0; n<members.Length; n++)
{
XmlTypeMapMember mapMem = CreateMapMember (members[n], ns);
mapping[n] = new XmlMemberMapping (members[n].MemberName, ns, mapMem, true);
}
XmlMembersMapping mps = new XmlMembersMapping (elementName, ns, hasWrapperElement, writeAccessors, mapping);
mps.RelatedMaps = relatedMaps;
mps.Format = SerializationFormat.Encoded;
mps.Source = new MembersSerializationSource (elementName, hasWrapperElement, members, writeAccessors, false, null, includedTypes);
return mps;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:14,代码来源:SoapReflectionImporter.cs
示例6: ExportXmlSerializable_NestedClassMapping
public void ExportXmlSerializable_NestedClassMapping () {
XmlSchemas schemas = new XmlSchemas ();
XmlReflectionMember xmlReflectionMember = new XmlReflectionMember ();
XmlSchemaExporter xmlSchemaExporter = new XmlSchemaExporter (schemas);
XmlReflectionImporter xmlReflectionImporter = new XmlReflectionImporter ();
//Export mapping for DataSet1 class.
xmlReflectionMember.MemberType = typeof (DataSet1);
XmlMembersMapping xmlMembersMapping = xmlReflectionImporter.ImportMembersMapping ("DataSet1Response", "ResponseNamespace",
new XmlReflectionMember [] { xmlReflectionMember }, true);
xmlSchemaExporter.ExportMembersMapping (xmlMembersMapping);
//Export mapping for nested of DataSet1 class.
xmlReflectionMember.MemberType = typeof (DataSet1.DataTable1DataTable);
xmlMembersMapping = xmlReflectionImporter.ImportMembersMapping ("DataTable1DataTableResponse", "ResponseNamespace",
new XmlReflectionMember [] { xmlReflectionMember }, true);
xmlSchemaExporter.ExportMembersMapping (xmlMembersMapping);
}
开发者ID:Profit0004,项目名称:mono,代码行数:23,代码来源:XmlExportOfTypedDataSetTest.cs
示例7: ImportMembersMapping
MembersMapping ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, string ns, bool hasWrapperElement, bool writeAccessors, bool validateWrapperElement) {
MembersMapping members = new MembersMapping();
members.TypeDesc = typeScope.GetTypeDesc(typeof(object[]));
MemberMapping[] mappings = new MemberMapping[xmlReflectionMembers.Length];
for (int i = 0; i < mappings.Length; i++) {
try {
XmlReflectionMember member = xmlReflectionMembers[i];
MemberMapping mapping = ImportMemberMapping(member, ns, xmlReflectionMembers, hasWrapperElement ? XmlSchemaForm.Unqualified : XmlSchemaForm.Qualified);
if (member.IsReturnValue && writeAccessors) { // no special treatment for return values with doc/enc
if (i > 0) throw new InvalidOperationException(Res.GetString(Res.XmlInvalidReturnPosition));
mapping.IsReturnValue = true;
}
mappings[i] = mapping;
}
catch (Exception e) {
if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) {
throw;
}
throw ReflectionException(xmlReflectionMembers[i].MemberName, e);
}
catch {
throw ReflectionException(xmlReflectionMembers[i].MemberName, null);
}
}
members.Members = mappings;
members.HasWrapperElement = hasWrapperElement;
if (hasWrapperElement) {
members.ValidateRpcWrapperElement = validateWrapperElement;
}
members.WriteAccessors = writeAccessors;
members.IsSoap = true;
if (hasWrapperElement && !writeAccessors)
members.Namespace = ns;
return members;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:35,代码来源:soapreflectionimporter.cs
示例8: CreateMapMember
private XmlTypeMapMember CreateMapMember (Type declaringType, XmlReflectionMember rmember, string defaultNamespace)
{
XmlTypeMapMember mapMember;
XmlAttributes atts = rmember.XmlAttributes;
TypeData typeData = TypeTranslator.GetTypeData (rmember.MemberType);
if (atts.XmlArray != null) {
if (atts.XmlArray.Namespace != null && atts.XmlArray.Form == XmlSchemaForm.Unqualified)
throw new InvalidOperationException ("XmlArrayAttribute.Form must not be Unqualified when it has an explicit Namespace value.");
if (typeData.SchemaType != SchemaTypes.Array &&
!(typeData.SchemaType == SchemaTypes.Primitive && typeData.Type == typeof (byte [])))
throw new InvalidOperationException ("XmlArrayAttribute can be applied to members of array or collection type.");
}
#if !MOONLIGHT
if (atts.XmlAnyAttribute != null)
{
if ( (rmember.MemberType.FullName == "System.Xml.XmlAttribute[]") ||
(rmember.MemberType.FullName == "System.Xml.XmlNode[]") )
{
mapMember = new XmlTypeMapMemberAnyAttribute();
}
else
throw new InvalidOperationException ("XmlAnyAttributeAttribute can only be applied to members of type XmlAttribute[] or XmlNode[]");
}
else
#endif
if (atts.XmlAnyElements != null && atts.XmlAnyElements.Count > 0)
{
// no XmlNode type check is done here (seealso: bug #553032).
XmlTypeMapMemberAnyElement member = new XmlTypeMapMemberAnyElement();
member.ElementInfo = ImportAnyElementInfo (defaultNamespace, rmember, member, atts);
mapMember = member;
}
else if (atts.Xmlns)
{
XmlTypeMapMemberNamespaces mapNamespaces = new XmlTypeMapMemberNamespaces ();
mapMember = mapNamespaces;
}
else if (atts.XmlAttribute != null)
{
// An attribute
if (atts.XmlElements != null && atts.XmlElements.Count > 0)
throw new Exception ("XmlAttributeAttribute and XmlElementAttribute cannot be applied to the same member");
XmlTypeMapMemberAttribute mapAttribute = new XmlTypeMapMemberAttribute ();
if (atts.XmlAttribute.AttributeName.Length == 0)
mapAttribute.AttributeName = rmember.MemberName;
else
mapAttribute.AttributeName = atts.XmlAttribute.AttributeName;
mapAttribute.AttributeName = XmlConvert.EncodeLocalName (mapAttribute.AttributeName);
if (typeData.IsComplexType)
mapAttribute.MappedType = ImportTypeMapping (typeData.Type, null, defaultNamespace);
if (atts.XmlAttribute.Namespace != null && atts.XmlAttribute.Namespace != defaultNamespace)
{
if (atts.XmlAttribute.Form == XmlSchemaForm.Unqualified)
throw new InvalidOperationException ("The Form property may not be 'Unqualified' when an explicit Namespace property is present");
mapAttribute.Form = XmlSchemaForm.Qualified;
mapAttribute.Namespace = atts.XmlAttribute.Namespace;
}
else
{
mapAttribute.Form = atts.XmlAttribute.Form;
if (atts.XmlAttribute.Form == XmlSchemaForm.Qualified)
mapAttribute.Namespace = defaultNamespace;
else
mapAttribute.Namespace = "";
}
typeData = TypeTranslator.GetTypeData(rmember.MemberType, atts.XmlAttribute.DataType);
mapMember = mapAttribute;
}
else if (typeData.SchemaType == SchemaTypes.Array)
{
// If the member has a single XmlElementAttribute and the type is the type of the member,
// then it is not a flat list
if (atts.XmlElements.Count > 1 ||
(atts.XmlElements.Count == 1 && atts.XmlElements[0].Type != typeData.Type) ||
(atts.XmlText != null))
{
// A flat list
// check that it does not have XmlArrayAttribute
if (atts.XmlArray != null)
throw new InvalidOperationException ("XmlArrayAttribute cannot be used with members which also attributed with XmlElementAttribute or XmlTextAttribute.");
XmlTypeMapMemberFlatList member = new XmlTypeMapMemberFlatList ();
member.ListMap = new ListMap ();
member.ListMap.ItemInfo = ImportElementInfo (declaringType, XmlConvert.EncodeLocalName (rmember.MemberName), defaultNamespace, typeData.ListItemType, member, atts);
member.ElementInfo = member.ListMap.ItemInfo;
member.ListMap.ChoiceMember = member.ChoiceMember;
mapMember = member;
}
else
{
//.........这里部分代码省略.........
开发者ID:anand-bhola,项目名称:mono,代码行数:101,代码来源:XmlReflectionImporter.cs
示例9: ImportMembersMapping
XmlMembersMapping ImportMembersMapping (string elementName,
string ns,
XmlReflectionMember[] members,
bool hasWrapperElement,
bool writeAccessors,
bool validate,
XmlMappingAccess access)
{
// Reset (); Disabled. See ChangeLog
ArrayList mapping = new ArrayList ();
for (int n=0; n<members.Length; n++)
{
if (members[n].XmlAttributes.XmlIgnore) continue;
XmlTypeMapMember mapMem = CreateMapMember (null, members[n], ns);
mapMem.GlobalIndex = n;
mapMem.CheckOptionalValueType (members);
mapping.Add (new XmlMemberMapping (members[n].MemberName, ns, mapMem, false));
}
elementName = XmlConvert.EncodeLocalName (elementName);
XmlMembersMapping mps = new XmlMembersMapping (elementName, ns, hasWrapperElement, false, (XmlMemberMapping[])mapping.ToArray (typeof(XmlMemberMapping)));
mps.RelatedMaps = relatedMaps;
mps.Format = SerializationFormat.Literal;
Type[] extraTypes = includedTypes != null ? (Type[])includedTypes.ToArray(typeof(Type)) : null;
#if !NET_2_1
mps.Source = new MembersSerializationSource (elementName, hasWrapperElement, members, false, true, ns, extraTypes);
if (allowPrivateTypes) mps.Source.CanBeGenerated = false;
#endif
return mps;
}
开发者ID:anand-bhola,项目名称:mono,代码行数:30,代码来源:XmlReflectionImporter.cs
示例10: LoadBodyMapping
private XmlMembersMapping LoadBodyMapping(MessageDescription message, string mappingKey, out MessagePartDescriptionCollection rpcEncodedTypedMessageBodyParts)
{
MessagePartDescription returnPart;
string wrapperName, wrapperNs;
MessagePartDescriptionCollection bodyParts;
rpcEncodedTypedMessageBodyParts = null;
returnPart = OperationFormatter.IsValidReturnValue(message.Body.ReturnValue) ? message.Body.ReturnValue : null;
bodyParts = message.Body.Parts;
wrapperName = message.Body.WrapperName;
wrapperNs = message.Body.WrapperNamespace;
bool isWrapped = (wrapperName != null);
bool hasReturnValue = returnPart != null;
int paramCount = bodyParts.Count + (hasReturnValue ? 1 : 0);
if (paramCount == 0 && !isWrapped) // no need to create serializer
{
return null;
}
XmlReflectionMember[] members = new XmlReflectionMember[paramCount];
int paramIndex = 0;
if (hasReturnValue)
members[paramIndex++] = XmlSerializerHelper.GetXmlReflectionMember(returnPart, IsRpc, isWrapped);
for (int i = 0; i < bodyParts.Count; i++)
members[paramIndex++] = XmlSerializerHelper.GetXmlReflectionMember(bodyParts[i], IsRpc, isWrapped);
if (!isWrapped)
wrapperNs = ContractNamespace;
return ImportMembersMapping(wrapperName, wrapperNs, members, isWrapped, IsRpc, mappingKey);
}
开发者ID:weshaggard,项目名称:wcf,代码行数:30,代码来源:XmlSerializerOperationBehavior.cs
示例11: 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];
}
开发者ID:nekresh,项目名称:mono,代码行数:24,代码来源:BaseMessagesFormatter.cs
示例12: ImportMembersMapping
XmlMembersMapping ImportMembersMapping (string elementName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool writeAccessors, bool validate, XmlMappingAccess access)
{
elementName = XmlConvert.EncodeLocalName (elementName);
XmlMemberMapping[] mapping = new XmlMemberMapping[members.Length];
for (int n=0; n<members.Length; n++)
{
XmlTypeMapMember mapMem = CreateMapMember (members[n], ns);
mapping[n] = new XmlMemberMapping (XmlConvert.EncodeLocalName (members[n].MemberName), ns, mapMem, true);
}
XmlMembersMapping mps = new XmlMembersMapping (elementName, ns, hasWrapperElement, writeAccessors, mapping);
mps.RelatedMaps = relatedMaps;
mps.Format = SerializationFormat.Encoded;
Type[] extraTypes = includedTypes != null ? (Type[])includedTypes.ToArray(typeof(Type)) : null;
mps.Source = new MembersSerializationSource (elementName, hasWrapperElement, members, writeAccessors, false, null, extraTypes);
return mps;
}
开发者ID:nobled,项目名称:mono,代码行数:16,代码来源:SoapReflectionImporter.cs
示例13: BuildHeadersReflectionMembers
XmlReflectionMember [] BuildHeadersReflectionMembers (HeaderInfo[] headers)
{
XmlReflectionMember [] mems = new XmlReflectionMember [headers.Length];
for (int n=0; n<headers.Length; n++)
{
HeaderInfo header = headers [n];
XmlReflectionMember m = new XmlReflectionMember ();
m.IsReturnValue = false;
m.MemberName = header.HeaderType.Name;
m.MemberType = header.HeaderType;
// MS.NET reflects header classes in a weird way. The root element
// name is the CLR class name unless it is specified in an XmlRootAttribute.
// The usual is to use the xml type name by default, but not in this case.
XmlAttributes ats = new XmlAttributes (header.HeaderType);
if (ats.XmlRoot != null) {
XmlElementAttribute xe = new XmlElementAttribute ();
xe.ElementName = ats.XmlRoot.ElementName;
xe.Namespace = ats.XmlRoot.Namespace;
m.XmlAttributes = new XmlAttributes ();
m.XmlAttributes.XmlElements.Add (xe);
}
mems [n] = m;
}
return mems;
}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:30,代码来源:Methods.cs
示例14: MembersSerializationSource
public MembersSerializationSource (string elementName, bool hasWrapperElement, XmlReflectionMember [] members, bool writeAccessors,
bool literalFormat, string namspace, ArrayList includedTypes)
: base (namspace, includedTypes)
{
this.elementName = elementName;
this.hasWrapperElement = hasWrapperElement;
this.writeAccessors = writeAccessors;
this.literalFormat = literalFormat;
StringBuilder sb = new StringBuilder ();
sb.Append (members.Length.ToString(CultureInfo.InvariantCulture));
foreach (XmlReflectionMember mem in members)
mem.AddKeyHash (sb);
membersHash = sb.ToString();
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:16,代码来源:SerializationSource.cs
示例15: LoadHeadersMapping
private XmlMembersMapping LoadHeadersMapping(MessageDescription message, string mappingKey)
{
int headerCount = message.Headers.Count;
if (headerCount == 0)
return null;
int unknownHeaderCount = 0, headerIndex = 0;
XmlReflectionMember[] members = new XmlReflectionMember[headerCount];
for (int i = 0; i < headerCount; i++)
{
MessageHeaderDescription header = message.Headers[i];
if (!header.IsUnknownHeaderCollection)
{
members[headerIndex++] = XmlSerializerHelper.GetXmlReflectionMember(header, false/*isRpc*/, false/*isWrapped*/);
}
else
{
unknownHeaderCount++;
}
}
if (unknownHeaderCount == headerCount)
{
return null;
}
if (unknownHeaderCount > 0)
{
XmlReflectionMember[] newMembers = new XmlReflectionMember[headerCount - unknownHeaderCount];
Array.Copy(members, newMembers, newMembers.Length);
members = newMembers;
}
return ImportMembersMapping(ContractName, ContractNamespace, members, false /*isWrapped*/, false /*isRpc*/, mappingKey);
}
开发者ID:weshaggard,项目名称:wcf,代码行数:36,代码来源:XmlSerializerOperationBehavior.cs
示例16: ImportAnyElementInfo
XmlTypeMapElementInfoList ImportAnyElementInfo (string defaultNamespace, XmlReflectionMember rmember, XmlTypeMapMemberElement member, XmlAttributes atts)
{
XmlTypeMapElementInfoList list = new XmlTypeMapElementInfoList();
ImportTextElementInfo (list, rmember.MemberType, member, atts, defaultNamespace);
#if !MOONLIGHT // no practical anyElement support
foreach (XmlAnyElementAttribute att in atts.XmlAnyElements)
{
XmlTypeMapElementInfo elem = new XmlTypeMapElementInfo (member, TypeTranslator.GetTypeData(typeof(XmlElement)));
if (att.Name.Length != 0)
{
elem.ElementName = XmlConvert.EncodeLocalName(att.Name);
elem.Namespace = (att.Namespace != null) ? att.Namespace : "";
}
else
{
elem.IsUnnamedAnyElement = true;
elem.Namespace = defaultNamespace;
if (att.Namespace != null)
throw new InvalidOperationException ("The element " + rmember.MemberName + " has been attributed with an XmlAnyElementAttribute and a namespace '" + att.Namespace + "', but no name. When a namespace is supplied, a name is also required. Supply a name or remove the namespace.");
}
list.Add (elem);
}
#endif
return list;
}
开发者ID:anand-bhola,项目名称:mono,代码行数:27,代码来源:XmlReflectionImporter.cs
示例17: ImportMembersMapping
internal XmlMembersMapping ImportMembersMapping(string elementName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool rpc, string mappingKey)
{
string key = mappingKey.StartsWith(":", StringComparison.Ordinal) ? _keyBase + mappingKey : mappingKey;
return _parent._importer.ImportMembersMapping(new XmlName(elementName, true /*isEncoded*/), ns, members, hasWrapperElement, rpc, key);
}
开发者ID:weshaggard,项目名称:wcf,代码行数:5,代码来源:XmlSerializerOperationBehavior.cs
示例18: ImportEnumMapping
//.........这里部分代码省略.........
ArrayList fieldList = new ArrayList();
FieldInfo[] tfields = type.GetFields (BindingFlags.Instance | BindingFlags.Public);
#if TARGET_JVM
// This statement ensures fields are ordered starting from the base type.
for (int ti=0; ti<typeList.Count; ti++) {
for (int i=0; i<tfields.Length; i++) {
FieldInfo field = tfields[i];
if (field.DeclaringType == typeList[ti])
fieldList.Add (field);
}
}
#else
currentType = null;
int currentIndex = 0;
foreach (FieldInfo field in tfields)
{
// This statement ensures fields are ordered starting from the base type.
if (currentType != field.DeclaringType)
{
currentType = field.DeclaringType;
currentIndex=0;
}
fieldList.Insert(currentIndex++, field);
}
#endif
// Read all Properties via reflection.
ArrayList propList = new ArrayList();
PropertyInfo[] tprops = type.GetProperties (BindingFlags.Instance | BindingFlags.Public);
#if TARGET_JVM
// This statement ensures properties are ordered starting from the base type.
for (int ti=0; ti<typeList.Count; ti++) {
for (int i=0; i<tprops.Length; i++) {
PropertyInfo prop = tprops[i];
if (!prop.CanRead) continue;
if (prop.GetIndexParameters().Length > 0) continue;
if (prop.DeclaringType == typeList[ti])
propList.Add (prop);
}
}
#else
currentType = null;
currentIndex = 0;
foreach (PropertyInfo prop in tprops)
{
// This statement ensures properties are ordered starting from the base type.
if (currentType != prop.DeclaringType)
{
currentType = prop.DeclaringType;
currentIndex = 0;
}
if (!prop.CanRead) continue;
if (prop.GetIndexParameters().Length > 0) continue;
propList.Insert(currentIndex++, prop);
}
#endif
ArrayList members = new ArrayList();
int fieldIndex=0;
int propIndex=0;
// We now step through the type hierarchy from the base (object) through
// to the supplied class, as each step outputting all Fields, and then
// all Properties. This is the exact same ordering as .NET 1.0/1.1.
foreach (Type t in typeList)
{
// Add any fields matching the current DeclaringType.
while (fieldIndex < fieldList.Count)
{
FieldInfo field = (FieldInfo)fieldList[fieldIndex];
if (field.DeclaringType==t)
{
fieldIndex++;
XmlAttributes atts = attributeOverrides[type, field.Name];
if (atts == null) atts = new XmlAttributes (field);
if (atts.XmlIgnore) continue;
XmlReflectionMember member = new XmlReflectionMember(field.Name, field.FieldType, atts);
member.DeclaringType = field.DeclaringType;
members.Add(member);
}
else break;
}
// Add any properties matching the current DeclaringType.
while (propIndex < propList.Count)
{
PropertyInfo prop = (PropertyInfo)propList[propIndex];
if (prop.DeclaringType==t)
{
propIndex++;
XmlAttributes atts = attributeOverrides[type, prop.Name];
if (atts == null) atts = new XmlAttributes (prop);
if (atts.XmlIgnore) continue;
if (!prop.CanWrite && (TypeTranslator.GetTypeData (prop.PropertyType).SchemaType != SchemaTypes.Array || prop.PropertyType.IsArray)) continue;
XmlReflectionMember member = new XmlReflectionMember(prop.Name, prop.PropertyType, atts);
member.DeclaringType = prop.DeclaringType;
members.Add(member);
}
else break;
}
}
return members;
}
开发者ID:anand-bhola,项目名称:mono,代码行数:101,代码来源:XmlReflectionImporter.cs
示例19: ImportFaultElement
internal XmlMembersMapping ImportFaultElement(FaultDescription fault, out XmlQualifiedName elementName)
{
// the number of reflection members is always 1 because there is only one fault detail type
XmlReflectionMember[] members = new XmlReflectionMember[1];
XmlName faultElementName = fault.ElementName;
string faultNamespace = fault.Namespace;
if (faultElementName == null)
{
XmlTypeMapping mapping = _parent._importer.ImportTypeMapping(fault.DetailType);
faultElementName = new XmlName(mapping.ElementName, false /*isEncoded*/);
faultNamespace = mapping.Namespace;
if (faultElementName == null)
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.SFxFaultTypeAnonymous, this.Operation.Name, fault.DetailType.FullName)));
}
elementName = new XmlQualifiedName(faultElementName.DecodedName, faultNamespace);
members[0] = XmlSerializerHelper.GetXmlReflectionMember(null /*memberName*/, faultElementName, faultNamespace, fault.DetailType,
null /*additionalAttributesProvider*/, false /*isMultiple*/, false /*isWrapped*/);
string mappingKey = "fault:" + faultElementName.DecodedName + ":" + faultNamespace;
return ImportMembersMapping(faultElementName.EncodedName, faultNamespace, members, false /*hasWrapperElement*/, this.IsRpc, mappingKey);
}
开发者ID:weshaggard,项目名称:wcf,代码行数:24,代码来源:XmlSerializerOperationBehavior.cs
示例20: CheckOptionalValueType
public void CheckOptionalValueType (XmlReflectionMember[] members)
{
// Used when reflecting a list of members (e.g. web service parameters)
for (int n=0; n<members.Length; n++) {
XmlReflectionMember m = members [n];
if (m.MemberName == Name + "Specified" && m.MemberType == typeof(bool) && m.XmlAttributes.XmlIgnore) {
IsOptionalValueType = true;
_specifiedGlobalIndex = n;
break;
}
}
}
开发者ID:FrancisVarga,项目名称:mono,代码行数:12,代码来源:XmlTypeMapMember.cs
注:本文中的System.Xml.Serialization.XmlReflectionMember类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论