ISegmentData¶
ISegmentData is the uniform contract implemented by all 43 typed X12 segment classes in this library (AK1 through TRN). It defines the symmetric object-to-segment (Build) and segment-to-object (Fill) mapping that lets EDI parsing/serialization code work against a single abstraction instead of switching on concrete segment types, with SegmentId supplying the literal X12 segment identifier each implementation carries.
Purpose¶
- Establishes the segment identity contract (
SegmentId) that callers use to recognize and route a rawIEdiSegmentto the correct typed wrapper, consistent with the rule that a segment's first element is its identifier (BR-020). - Establishes
Build()as the outbound direction: converting a populated typed object into anIEdiSegmentready for serialization. - Establishes
Fill(IEdiSegment segment)as the inbound direction: populating a typed object's properties from a raw parsedIEdiSegment.
Context¶
- Namespace:
SAIF.Common.Files.Edi.Segments - Assembly/package:
SAIF.Framework.Common.Files
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| SegmentId | string SegmentId { get; } |
The literal X12 segment identifier (e.g. "ISA", "CLP") that this implementation represents. |
| Build | IEdiSegment Build() |
Produces an IEdiSegment populated from this object's properties, for outbound serialization. |
| Fill | void Fill(IEdiSegment segment) |
Populates this object's properties by reading elements from the supplied raw IEdiSegment, for inbound parsing. |
Behavioral notes¶
- Every implementing class also exposes a
static Parse(IEdiSegment segment)factory method that constructs a new instance and callsFillon it, thoughParseis not itself part of this interface*.
Constraints and usage notes¶
- Implementations are expected to map every documented X12 element position for their segment; some implementations throw
NotImplementedExceptionfromBuild()for segments that are inbound-only (BR-054).
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
- Common\SAIF.Common.Files\Edi\Segments\ISegmentData.cs