-
Notifications
You must be signed in to change notification settings - Fork 172
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
Serializing enums / reserializing file not 1:1 #183
Comments
Hi @shinji144 and thanks for your interenst in Edi.Net. The reason behind the different serialization behavior has todo with the sample. First of all this usecase shows how someone needing to read an Edi transmission could decide to deserialize characters as well as letters into CLR enums. This feature unfortunately does not work bothways at the moment. It is however a nice enhancement since we could infer the serialization preference from the Picture (format) on the value attribute and decide whether we need to convert to the numeric counterpart underneath (which is the default behavior) or use the name instead. On the other hand there is no complete parity between the sample nodels and the transmission. In other words models may be incomplete and ignore parts of the data hence the difference in serialized output. The example is meant to showcase the power that the library has in mappind edi to a more dotnet friendly poco class. In case you need to have a one to one parity you need to tweak the example models to suit your needs. |
When setting an alphanumeric picture to X(n), then automatically its gonna translate to Enum Name, not the integer. Also, two test cases were provided in EdiTextWriterTests.cs. This Implementation need to be analyzed because of changes in the ConvertUtils.cs, maybe we need to change de approach to some code that Add Function not change the function. This can be addressed to Issue indice-co#183
* #Feature - Writer limits the amount of chars baseada on Alphanumeric Picture Kind #198 Strict Approach should be set by using GRAMMAR.SetStrictAlphanumericCharLimit(strictAlphanumericCharLimit) function * Update EdiGrammar.cs #FIX - StrictAlphanumericCharLimit options under EdiWriter class * Update EdiTextWriter.cs #FIX - StrictAlphanumericCharLimit options under EdiWriter class * Update EdiWriter.cs #FIX - StrictAlphanumericCharLimit options under EdiWriter class * Update IEdiGrammar.cs #FIX - StrictAlphanumericCharLimit options under EdiWriter class * Update IEdiGrammar.cs #FIX - StrictAlphanumericCharLimit options under EdiWriter class * Update EdiTextWriterTests.cs #FIX - StrictAlphanumericCharLimit options under EdiWriter class * #Add - Writes Enum as Text when Alphanumeric Picture is Provided When setting an alphanumeric picture to X(n), then automatically its gonna translate to Enum Name, not the integer. Also, two test cases were provided in EdiTextWriterTests.cs. This Implementation need to be analyzed because of changes in the ConvertUtils.cs, maybe we need to change de approach to some code that Add Function not change the function. This can be addressed to Issue #183
Double segment serialization when using wildcard paths #235
Hi @cleftheris,
I've followed the tutorial to serialize/deserialize, using the provided sample file "tradacoms.utilitybill.edi". Deserializing that file provides me a POCO wherein the VatRateCategoryCode gets set to L. However, serializing the same POCO using same grammar yields me a vastly different .edi file compared to the original- and the enum is serialized to its integer equivalent instead of the text.
Why does the enum get serialized as an integer? And why does the reserialized file look dramatically different from the sample?
Thanks!
The text was updated successfully, but these errors were encountered: