Does EdiSegmentGroup care about ordering?
patricktimessupermarket opened this issue · 1 comments
patricktimessupermarket commented
Hi,
I have a question regarding ordering in EdiSegmentGroup. This is from X12_850.cs. As you can see the order is N1,N2,N3,N4.
[EdiSegmentGroup("N1", "N2", "N3", "N4", Description = "N - Addresses")]
public class Address
{
[EdiValue(Path = "N1/0", Description = "N101 - Address Code")]
public string AddressCode { get; set; }
[EdiValue(Path = "N1/1", Description = "N102 - Address Name")]
public string AddressName { get; set; }
[EdiValue(Path = "N3/0", Description = "N301 - Address Information")]
public string AddressInformation { get; set; }
[EdiValue(Path = "N4/0", Description = "N401 - City Name")]
public string CityName { get; set; }
[EdiValue(Path = "N4/3", Description = "N404 - Country Code")]
public string CountryCode { get; set; }
}
However when I read a data
N1*N101*N102*92*0857673380000~
N4*N401*UT*98034*N404~
N3*N301#2~
It would read all 3 N values even though N3 is in the wrong order. Is this the intended behavior? I was expecting it to read N1 and N4 and then skip N3.
cleftheris commented
Hi @patricktimessupermarket and thank you for your interest in EDI.Net.
This is weird I haven't had such a use-case before. You can try to add a separate class for each of the NX segments and have the address segmentgroup subclass the N1.
It should work so I will mark this for enhancement.