Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SegmentGroup Deserialization #230

Open
tomtom4848 opened this issue May 23, 2022 · 0 comments
Open

SegmentGroup Deserialization #230

tomtom4848 opened this issue May 23, 2022 · 0 comments

Comments

@tomtom4848
Copy link

Hi,
I have a little bit trouble with the deserialization of a SegmentGroup...

My Model looks like this (only the relevant parts):

 public class Edifact_IC
{
    public UNB_Segment UNB { get; set; }
    public IC_Message Message { get; set; }
    public UNZ_Segment UNZ { get; set; }
}

[EdiMessage]
public class IC_Message
{
    ......
    public List <SG1_Ref> Ref { get; set; }
    .....
}


//------SegmentGroups-----
[EdiSegmentGroup("RFF", "DTM"),EdiCondition("...", "...", Path = "RFF/0/0")]
public class SG1_Reference 
{
    public RFF_Segment Ref { get; set; }
    public List <DTM_Segment> Date { get; set; }
}


//------Segments-----
......
[EdiSegment, EdiPath("RFF")]
public class RFF_Segment
{
    [EdiValue("X(3)", Mandatory = true, Path = "RFF/0/0")]
    public string Qualifier { get; set; }

    [EdiValue("X(70)", Mandatory = false, Path = "RFF/0/1")]
    public string Reference { get; set; }
.....
}

If I try to deserialize following (only EDIFACT Snipped for testing):
UNA:+.? ' UNB+UNOC:3+XXXXXXXXXX:500+XXXXXXXXX:500+XXXXXX:0610+XXXXXXXXX++VL' UNH+XXXXXXX+XXXXX:X:XXX:XX:2.3c' RFF+AGI:XXXXX' DTM+293:20181001060000:204' UNZ+1+XXXXXXXXXXXX'

the "RFF-Segment" property (Ref) in "SG1_Reference" is always Null. The DTM-Segment in the same SegmentGroup is correct...

If I change the SegmentGroup Class to:

//------SegmentGroups-----
[EdiSegmentGroup("RFF", "DTM"),EdiCondition("...", "...", Path = "RFF/0/0")]
public class SG1_Reference : RFF_Segment
{
    //public RFF_Segment Ref { get; set; }
    public List <DTM_Segment> Date { get; set; }
}

the deserialization works good, but I have now (obviously) not a RFF_Segment property but the "Qualifier" and "Reference" properties.

How do I change the SG1_Reference class that I have a RFF_Segment and a DTM_Segment property?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant