cancel
Showing results for 
Search instead for 
Did you mean: 

PowerDesigner 15 - Generated code - Serialization - C# - How to generate the [XmlInclude] attribute ?

Former Member
0 Kudos

Hi :o),

I'm using PowerDesigner 15 and I would like the code generated for each serializable class contains the "[XmlInclude(typeof (CHILD_OBJ))]" attribute that describes child objects.

How could I do, please ?

Best Regards,

Cyrille

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Would there an alternate solution better than using either "partial classes", or a custom xml-serializer-overrides, please ?

Regards,

Cyrille

Former Member
0 Kudos

Can you provide a full code sample of what you want the generator to produce?

Former Member
0 Kudos

Hi ,

Here is a sample of what I'd like the generator to produce (it's OK to produce the [Serializable] attribute, but not for the [XmlInclude(...)] attribute) :

using System;

using System.Xml.Serialization;

namespace Generated

{

    /// <summary>

    ///     Classe de base d'une information

    /// </summary>

    [Serializable]

    [XmlInclude(typeof(SubClassA))]

    [XmlInclude(typeof(SubClassB))]

    [XmlInclude(typeof(SubClassC))]

    [XmlInclude(typeof(SubClassD))]

    public abstract partial class MyClass : IInterface1

    {

        private string m_Label;

        private int m_Number;

        private long m_Id;

        public long Id

        {

            get { return m_Id; }

            set { m_Id = value; }

        }

        public string Label

        {

            get { return m_Label; }

            set { m_Label = value; }

        }

        public int Number

        {

            get { return m_Number; }

            set { m_Number = value; }

        }

    }

}

And here's a context (it's OK to produce that below) :

namespace Generated

{

   [Serializable]

   public  partial  class SubClassA : MyClass , IInterface2, IInterface3

   {...}

}

etc.