Reputation: 574
I'm starting a research task for handling UBL 2.1 invoices in a .net 6 project.
From a quick research there seems to be a "popular" .net library , namely UblSharp.
Unfortunately, it seems it hasn't been updated from a long time, last release was on May 2019.I understand that UBL 2.1. is a standard from November 2013, so the current UblSharp should still work as expected.
But i'm not very enthusiastic of using a third party library, that isn't maintained anymore. Moreover, once we need to use UBL 2.2 or higher, we will need a different approach, as UblSharp only works up to 2.1.
Another approach could be to manually create the C# classes needed to handle UBL 2.1, for example, using something like XmlSchemaClassGenerator https://github.com/mganss/XmlSchemaClassGenerator
From a theorethical prespective (and please understand that i'm just starting the research, so i might be wrong), by creating specific .net classes to handle the UBL 2.1 specification should allow me to easily handle UBL 2.1 invoices.
I'm tempted in going with XmlSchemaClassGenerator approach.
Am i missing anything or being over simplistic?
Thank you!
Upvotes: 1
Views: 1916
Reputation: 574
In the end, i opted to test all alternatives:
Direct XSD to c# classes with LinqToXsdCore
Direct XSD to c# classes with LinqToXsdCore
I've used the UBL 2.1 specification available on the OASIS documents. When generating the Invoice classes from the UBL-Invoice-2.1.xsd specification i got some errors:
Third party libs
Both UblSharp and UblTr were simple to use. UblSharp isn't maintained since 2019, but given that the UBL 2.1 specification is from 2013, it shouldn't matter.
UblTr was updated on Dec/2023, but seems to be specific for Turkey.
Both handled the UBL 2.1 Invoice example file perfectly.
I did a very crude benchmark, and direct c# classes from xsd, and UblSharp (around 70-90ms) are more or less equivalent, with UblTr with higher process times (around 400ms).
Upvotes: 5