indice-co / EDI.Net

EDI Serializer/Deserializer. Supports EDIFact, X12 and TRADACOMS formats
MIT License
447 stars 170 forks source link

Deserialize of X12 does not work on deeply nested segmentgroups #225

Open tpod opened 2 years ago

tpod commented 2 years ago

After checking a lot of old issues and documentation I'm fairly sure how to structure the mapping. Although I may have a mistake.

But for some reason mapping stops working on deeply nested object (INSLoop works ok, but one deeper NM1Loop does not). Please check the pullrequest and test for details.

@cleftheris hope you can find whats wrong.

Thanks!

tcsyring commented 2 years ago

If you referring to a 2100 loop (NM1 loop), this is how I got it to work.

 [EdiSegmentGroup("INS", SequenceEnd = "SE"), EdiElement]
    public class Loop2000 : INS
    {
        public List<REF> REFs { get; set; }

        public List<DTP> DTPs { get; set; }

        public List<Loop2100> Loop2100s { get; set; } 
        ...
      }

 [EdiSegmentGroup("NM1", new[] { "PER", "N3", "N4", "DMG", "EC", "ICM", "AMT", "HLH", "HI", "LUI" })]
    public class Loop2100 : NM1
    {
        public PER PER { get; set; }
        public N3 N3 { get; set; }
        public N4 N4 { get; set; }
        ...
     }