2011-08-09 26 views
1

基本クラス型の配列から派生クラスをシリアル化する際に問題が発生しています。 シリアル化された要素名には派生クラスが反映されているため、派生クラスをシリアル化すると正常に認識されますが、派生クラスに固有のプロパティはオブジェクトとシリアル化されません。基本クラスから派生クラスへxmlをシリアル化する問題

基本クラス:クラス派生

[System.Xml.Serialization.XmlIncludeAttribute(typeof(ContactsFolderType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CalendarFolderType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(FolderType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(TasksFolderType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SearchFolderType))] 
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] 
[System.SerializableAttribute()] 
[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.ComponentModel.DesignerCategoryAttribute("code")] 
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://schemas.microsoft.com/exchange/services/2006/types")] 
public abstract partial class BaseFolderType 
{ 

    private FolderIdType folderIdField; 

    private FolderIdType parentFolderIdField; 

    private string folderClassField; 

    private string displayNameField; 

    private int totalCountField; 

    private bool totalCountFieldSpecified; 

    private int childFolderCountField; 

    private bool childFolderCountFieldSpecified; 

    private ExtendedPropertyType[] extendedPropertyField; 

    private ManagedFolderInformationType managedFolderInformationField; 

    private EffectiveRightsType effectiveRightsField; 

    /// <remarks/> 
    public FolderIdType FolderId 
    { 
     get 
     { 
      return this.folderIdField; 
     } 
     set 
     { 
      this.folderIdField = value; 
     } 
    } 

    /// <remarks/> 
    public FolderIdType ParentFolderId 
    { 
     get 
     { 
      return this.parentFolderIdField; 
     } 
     set 
     { 
      this.parentFolderIdField = value; 
     } 
    } 

    /// <remarks/> 
    public string FolderClass 
    { 
     get 
     { 
      return this.folderClassField; 
     } 
     set 
     { 
      this.folderClassField = value; 
     } 
    } 

    /// <remarks/> 
    public string DisplayName 
    { 
     get 
     { 
      return this.displayNameField; 
     } 
     set 
     { 
      this.displayNameField = value; 
     } 
    } 

    /// <remarks/> 
    public int TotalCount 
    { 
     get 
     { 
      return this.totalCountField; 
     } 
     set 
     { 
      this.totalCountField = value; 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlIgnoreAttribute()] 
    public bool TotalCountSpecified 
    { 
     get 
     { 
      return this.totalCountFieldSpecified; 
     } 
     set 
     { 
      this.totalCountFieldSpecified = value; 
     } 
    } 

    /// <remarks/> 
    public int ChildFolderCount 
    { 
     get 
     { 
      return this.childFolderCountField; 
     } 
     set 
     { 
      this.childFolderCountField = value; 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlIgnoreAttribute()] 
    public bool ChildFolderCountSpecified 
    { 
     get 
     { 
      return this.childFolderCountFieldSpecified; 
     } 
     set 
     { 
      this.childFolderCountFieldSpecified = value; 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlElementAttribute("ExtendedProperty")] 
    public ExtendedPropertyType[] ExtendedProperty 
    { 
     get 
     { 
      return this.extendedPropertyField; 
     } 
     set 
     { 
      this.extendedPropertyField = value; 
     } 
    } 

    /// <remarks/> 
    public ManagedFolderInformationType ManagedFolderInformation 
    { 
     get 
     { 
      return this.managedFolderInformationField; 
     } 
     set 
     { 
      this.managedFolderInformationField = value; 
     } 
    } 

    /// <remarks/> 
    public EffectiveRightsType EffectiveRights 
    { 
     get 
     { 
      return this.effectiveRightsField; 
     } 
     set 
     { 
      this.effectiveRightsField = value; 
     } 
    } 
} 

:BaseFolderTypeの配列にこのクラスを追加する際に

[System.Xml.Serialization.XmlIncludeAttribute(typeof(TasksFolderType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SearchFolderType))] 
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] 
[System.SerializableAttribute()] 
[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.ComponentModel.DesignerCategoryAttribute("code")] 
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://schemas.microsoft.com/exchange/services/2006/types")] 
public partial class FolderType : BaseFolderType 
{ 

    private PermissionSetType permissionSetField; 

    private int unreadCountField; 

    private bool unreadCountFieldSpecified; 

    /// <remarks/> 
    public PermissionSetType PermissionSet 
    { 
     get 
     { 
      return this.permissionSetField; 
     } 
     set 
     { 
      this.permissionSetField = value; 
     } 
    } 

    /// <remarks/> 
    public int UnreadCount 
    { 
     get 
     { 
      return this.unreadCountField; 
     } 
     set 
     { 
      this.unreadCountField = value; 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlIgnoreAttribute()] 
    public bool UnreadCountSpecified 
    { 
     get 
     { 
      return this.unreadCountFieldSpecified; 
     } 
     set 
     { 
      this.unreadCountFieldSpecified = value; 
     } 
    } 
} 

、シリアル化された要素は

<Folder> 
<FolderId/> 
<DisplayName/> 
... 
</Folder> 
All the base properties but none of the derived ones. 

を返します。私は何かが足りませんこれを引き起こすために私のXML属性の設定で?

答えて

関連する問題