EDI.Net
EDI.Net copied to clipboard
Different path length for same segment
I am currently using version 1.3.3 and during the upgrade to the current version I have encountered the following problem:
I have a message that contains the following sequence
SEQ+Z02'
CCI+Z17'
CAV+Z64'
CAV+Z63'
CCI+Z26++ZA8'
CAV+Z84'
I'm using the following code for the serializer:
[EdiSegment, EdiSegmentGroup("SEQ")]
public class SEQ_Z02_SegmentGroup
{
[EdiCondition("Z17", Path = "CCI/0/0")]
public CCI_CAV_SegmentGroup Attribute1 { get; set; }
[EdiCondition("ZA8", Path = "CCI/2/0")]
public CCI_CAV_SegmentGroup Atrribute2 { get; set; }
}
[EdiSegment, EdiSegmentGroup("CCI", SequenceEnd = "CCI")]
public class CCI_CAV_SegmentGroup
{
[EdiValue("X(3)", Mandatory = false, Path = "CCI/0/0")]
public string CCIAttribute1 { get; set; }
[EdiValue("X(3)", Mandatory = false, Path = "CCI/1/0")]
public string CCIAttribute2 { get; set; }
[EdiValue("X(17)", Mandatory = false, Path = "CCI/2/0")]
public string CCIAttribute3 { get; set; }
[EdiValue("X(17)", Mandatory = false, Path = "CCI/2/1")]
public string CCIAttribute4 { get; set; }
[EdiValue("X(3)", Mandatory = false, Path = "CCI/2/2")]
public string CCIAttribute5 { get; set; }
[EdiValue("X(35)", Mandatory = false, Path = "CCI/2/3")]
public string CCIAttribute6 { get; set; }
public List<CAV_Komplett> CAVAttributes { get; set; }
}
With the old version this works fine but if I upgrade to a newer version the value "Z17" in the second line is found but not set in CCIAttribute1
. I found two possibilities to make it work (but unfortunately they are not feasible for my use case):
- Drop
Attribute2
from my class. As long as there are no other path length for the same segment this works with the current version - Add additional delimiters to the second line. If I change the second line to
CCI+Z17++'
, the value can be found with the newer version.
Is there any possbility to make different path values work for the same segment in EdiCondition
?
Hi @S3ph3r can you please try to provide with pull request that has a failing test in the tests project. It will make it easier to investigate and fix.
Also have you seen the use of wildcard paths?
Hi @cleftheris! Thanks for answering so quickly. I have added a pull request where I recreated the problem that I have encountered as well as the two mentioned "fixes".
@cleftheris I was wondering if you had a chance to look at the pull request?