.NET XmlSerializer and multiple references to the same object

前端 未结 5 579
你的背包
你的背包 2021-01-05 04:52

My repository has List, List and List where an Enrolment has Enrolment.Student and Enrol

5条回答
  •  一生所求
    2021-01-05 05:32

    You can implement interface IXmlSerializable to Enrolment and in WriteXml method generate student and course XML which will contains only keys e.g.:

    
    
    

    and in ReadXml method you can load references from this. You must also set XmlIgnore attribute to Student and Course property.

提交回复
热议问题