-
Notifications
You must be signed in to change notification settings - Fork 171
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
Deserializing an Edifact file containing an unknown message type #188
Comments
Hi @h0gh and thanks for your interest in EDI.Net. As I remember it could be possible with some tweaking since this is the way that TRADACOMS works. See here for a sample with multiple message types in the same transmission https://github.com/indice-co/EDI.Net/blob/master/test/indice.Edi.Tests/Models/UtilityBill.cs. The only problem (missing part) with polymorphism & serialization as far as I can tell is that you will have to introduce some new attribute type that signals the serializer to search for CLR types elsewhere than the current model. There was something similar that existed in wcf, the KnownTypesAttribute . |
Thanks. I don't truly need the inheritance, and I got it working by having N separate adjacent lists of messages for each of the N message types. I had tried this previously, but dismissed it because it caused my program to eat all my memory and crash. This turned out to be because I had an off-by-one error in my Edicondition path. The correct path to the edifact document type is UNH/1/0, not UNH/2/0. When using the path UNH/2/0, I believe the deserializer gets stuck in an infinite loop in the EdiSerializer.SearchForward method (the do-while in lines 654-665). I can submit a PR with a test exhibiting this behavior if you're interested. |
Hi @h0gh |
There is a new version that addresses the infinite loop issue. Thanks for your contribution! |
Thanks! |
Hi there,
Is it possible to construct interchange and message objects along the following lines:
So that I can deserialize a file with any type of message in it, without knowing which type up front?
Thank you for the great library
The text was updated successfully, but these errors were encountered: