This project has moved and is read-only. For the latest updates, please go here.

Create X12 document from object possible?

Sep 20, 2013 at 11:05 PM
I understand I can parse x12 messages using library. But can it work other way around? I.E. Generate valid X12 document?
Oct 14, 2013 at 11:07 AM
Yes it can. If you look at IEdiParser interface, there are two methods:

T ToInterchange<T>(Stream ediStream, string origin); -- this one is for EDI to XML\C# object

List<string> ToEdi<T>(T interchangeEnvelope, string origin, InterchangeContext context); -- this one is for C# object\XML to EDI

Use ToEdi to generate a raw EDI. The building of the typed object though could be quite a challenging task in it's own. There are different approaches to this and they all include some sort of 'mapping' between your source and the typed edi. Some ideas for mapping:
  • Automapper
  • Xslt
  • Xquery\Xpath
  • Custom .NET mapper