Serialization.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Burton

    Serialization.

    Hopefully this is the right group.

    I am getting the following exeption:

    Member 'PPRP602AType.R PLY_HEADER' hides inherited member
    'REPLYType.RPLY _HEADER'
    , but has different custom attributes.
    at
    System.Xml.Seri alization.Struc tMapping.FindDe claringMapping( MemberMapping
    member, StructMapping& declaringMappin g, String parent)
    at System.Xml.Seri alization.Struc tMapping.Declar es(MemberMappin g member,
    Stri
    ng parent)
    at
    System.Xml.Seri alization.XmlRe flectionImporte r.ImportStructL ikeMapping(Str
    uctModel model, String ns)

    The 'REPLYType.RPLY _HEADER' is abstract and specified as:

    public abstract class REPLYType
    {
    #region Accessor Functions
    public abstract RPLY_HEADERType RPLY_HEADER
    {
    get;
    set;
    }
    #endregion
    }

    Then I derive from there

    public sealed class PPRP602AType : REPLYType

    and implement the abstract property:

    #region Private Members
    private RPLY_HEADERType _RPLY_HEADER;
    #endregion
    #region Accessor Functions
    [XmlElement(Elem entName="RPLY_H EADER_PPRP602A" )]
    public override RPLY_HEADERType RPLY_HEADER
    {
    get
    {
    return _RPLY_HEADER;
    }
    set
    {
    _RPLY_HEADER = value;
    }
    }
    #endregion

    What am I doing wrong? Why the serialization exception?

    Thank you.

    Kevin
  • erymuzuan

    #2
    Re: Serialization.

    Xml Serialization never take attribute with it in inheritance chains ,
    so you have to copy and paste the attribute if any exists between your
    base class and derive class

    regards
    erymuzuan mustapa

    Kevin Burton wrote:[color=blue]
    > Hopefully this is the right group.
    >
    > I am getting the following exeption:
    >
    > Member 'PPRP602AType.R PLY_HEADER' hides inherited member
    > 'REPLYType.RPLY _HEADER'
    > , but has different custom attributes.
    > at
    > System.Xml.Seri alization.Struc tMapping.FindDe claringMapping( MemberMapping
    > member, StructMapping& declaringMappin g, String parent)
    > at System.Xml.Seri alization.Struc tMapping.Declar es(MemberMappin g member,
    > Stri
    > ng parent)
    > at
    > System.Xml.Seri alization.XmlRe flectionImporte r.ImportStructL ikeMapping(Str
    > uctModel model, String ns)
    >
    > The 'REPLYType.RPLY _HEADER' is abstract and specified as:
    >
    > public abstract class REPLYType
    > {
    > #region Accessor Functions
    > public abstract RPLY_HEADERType RPLY_HEADER
    > {
    > get;
    > set;
    > }
    > #endregion
    > }
    >
    > Then I derive from there
    >
    > public sealed class PPRP602AType : REPLYType
    >
    > and implement the abstract property:
    >
    > #region Private Members
    > private RPLY_HEADERType _RPLY_HEADER;
    > #endregion
    > #region Accessor Functions
    > [XmlElement(Elem entName="RPLY_H EADER_PPRP602A" )]
    > public override RPLY_HEADERType RPLY_HEADER
    > {
    > get
    > {
    > return _RPLY_HEADER;
    > }
    > set
    > {
    > _RPLY_HEADER = value;
    > }
    > }
    > #endregion
    >
    > What am I doing wrong? Why the serialization exception?
    >
    > Thank you.
    >
    > Kevin[/color]

    Comment

    • Kevin Burton

      #3
      Re: Serialization.

      The abstract class is not decorated at all. The overridden property is
      decorated as below. How should this change to avoid the exception?

      Kevin

      "erymuzuan" wrote:
      [color=blue]
      > Xml Serialization never take attribute with it in inheritance chains ,
      > so you have to copy and paste the attribute if any exists between your
      > base class and derive class
      >
      > regards
      > erymuzuan mustapa
      >
      > Kevin Burton wrote:[color=green]
      > > Hopefully this is the right group.
      > >
      > > I am getting the following exeption:
      > >
      > > Member 'PPRP602AType.R PLY_HEADER' hides inherited member
      > > 'REPLYType.RPLY _HEADER'
      > > , but has different custom attributes.
      > > at
      > > System.Xml.Seri alization.Struc tMapping.FindDe claringMapping( MemberMapping
      > > member, StructMapping& declaringMappin g, String parent)
      > > at System.Xml.Seri alization.Struc tMapping.Declar es(MemberMappin g member,
      > > Stri
      > > ng parent)
      > > at
      > > System.Xml.Seri alization.XmlRe flectionImporte r.ImportStructL ikeMapping(Str
      > > uctModel model, String ns)
      > >
      > > The 'REPLYType.RPLY _HEADER' is abstract and specified as:
      > >
      > > public abstract class REPLYType
      > > {
      > > #region Accessor Functions
      > > public abstract RPLY_HEADERType RPLY_HEADER
      > > {
      > > get;
      > > set;
      > > }
      > > #endregion
      > > }
      > >
      > > Then I derive from there
      > >
      > > public sealed class PPRP602AType : REPLYType
      > >
      > > and implement the abstract property:
      > >
      > > #region Private Members
      > > private RPLY_HEADERType _RPLY_HEADER;
      > > #endregion
      > > #region Accessor Functions
      > > [XmlElement(Elem entName="RPLY_H EADER_PPRP602A" )]
      > > public override RPLY_HEADERType RPLY_HEADER
      > > {
      > > get
      > > {
      > > return _RPLY_HEADER;
      > > }
      > > set
      > > {
      > > _RPLY_HEADER = value;
      > > }
      > > }
      > > #endregion
      > >
      > > What am I doing wrong? Why the serialization exception?
      > >
      > > Thank you.
      > >
      > > Kevin[/color]
      >[/color]

      Comment

      Working...