![]() |
VOOZH | about |
dotnet add package OpenTraceability --version 1.5.84
NuGet\Install-Package OpenTraceability -Version 1.5.84
<PackageReference Include="OpenTraceability" Version="1.5.84" />
<PackageVersion Include="OpenTraceability" Version="1.5.84" />Directory.Packages.props
<PackageReference Include="OpenTraceability" />Project file
paket add OpenTraceability --version 1.5.84
#r "nuget: OpenTraceability, 1.5.84"
#:package OpenTraceability@1.5.84
#addin nuget:?package=OpenTraceability&version=1.5.84Install as a Cake Addin
#tool nuget:?package=OpenTraceability&version=1.5.84Install as a Cake Tool
This is an open-source library for handling traceability data in .NET using C#.
In version 1.4, the OpenTraceability C# project was updated to target .Net Standard 2.0. This update provides support for .NET Framework versions 4.6.1 and greater while maintaining support for .NET and .NET CORE 2.0+. This allows .NET framework projects to consume the OpenTraceability nuget package while preserving support for later versions of .NET Core and .NET.
Before you can use the library you need to make sure to call the Setup method.
If you are just using the core library, you should call:
OpenTraceability.Setup.Initialize();
However, if you are using an extension library such as:
Then you just need to call the setup method for that library such as:
OpenTraceability.GDST.Setup.Initialize();And that will initialize everything you need.
We have C# models that represent the various data objects in EPCIS including events, documents, and master data. Feel free to explore them.
This library was designed so that it could easily be extended to support many new CTEs/KDEs. It was also designed so that even without an extension library, the core library can still receive CTEs/KDEs from unknown extensions and namespaces and serialize/deserialize the data without losing any information.
More information on extensions can be found in the documentation later on. (coming soon)
These two objects inherit from the same base class EPCISBaseDocument and represent the two types of documents in EPCIS. They are
used to represent the XML and JSON-LD versions of the documents. The Events and Master Data are stored in the EPCISBaseDocument.Events
and EPCISBaseDocument.MasterData properties respectively.
It's important to note that the EPCISBaseDocument.EPCISVersion property is used to determine the version of the document. This is important
because when mapping from the models into the XML or JSON-LD formats, the version is used to determine which format to use. If you are
trying to map into EPCIS XML 2.0 and not EPCIS XML 1.2, then you need to make sure that the EPCISBaseDocument.Version property is set to EPCISVersion.V2.
The XML format for EPCIS 1.2 and 2.0 require a Standard Business Document Header (SBDH). This is represented by the StandardBusinessDocumentHeader class.
When converting from EPCIS JSON-LD into XML, you need to make sure to set this if the check schema is enabled. Otherwise, you will fail the schema validation.
You can use
StandardBusinessDocumentHeader.DummyHeaderto get a dummy header that you can use to pass schema validation for the XML formats.
We support mapping between EPCIS 1.2 XML, EPCIS 2.0 XML, and EPCIS 2.0 JSON-LD. Our mappers are thread-safe and are accessible from the OpenTraceability.Mappers.OpenTraceabilityMappers static object.
In order to read an EPCIS Query Document from an XML string in the EPCIS 1.2 xml format you can do the following:
// You can read an XML string representing an EPCIS 1.2 Query Document in XML format.
EPCISQueryDocument doc = OpenTraceabilityMappers.EPCISQueryDocument.XML.Map(queryDocXmlStr);
In order to read an EPCIS Document from an XML string in the EPCIS 1.2 xml format you can do the following:
// You can read an XML string representing an EPCIS 1.2 Document in XML format.
EPCISDocument doc = OpenTraceabilityMappers.EPCISDocument.XML.Map(docXmlStr);
This is done the same way as the 1.2 XML above. It auto-detects the version and maps it to the correct object.
In order to read an EPCIS Query Document from an XML string in the EPCIS 2.0 xml format you can do the following:
// You can read an XML string representing an EPCIS 2.0 Query Document in XML format.
EPCISQueryDocument doc = OpenTraceabilityMappers.EPCISQueryDocument.XML.Map(queryDocXmlStr);
In order to read an EPCIS Document from an XML string in the EPCIS 2.0 xml format you can do the following:
// You can read an XML string representing an EPCIS 2.0 Document in XML format.
EPCISDocument doc = OpenTraceabilityMappers.EPCISDocument.XML.Map(docXmlStr);
In order to read an EPCIS Query Document from a JSON string in the EPCIS 2.0 JSON-LD format you can do the following:
// You can read an XML string representing an EPCIS 2.0 Query Document in JSON-LD format.
EPCISQueryDocument doc = OpenTraceabilityMappers.EPCISQueryDocument.JSON.Map(queryDocXmlStr);
In order to read an EPCIS Document from a JSON string in the EPCIS 2.0 JSON-LD format you can do the following:
// You can read an XML string representing an EPCIS 2.0 Document in JSON-LD format.
EPCISDocument doc = OpenTraceabilityMappers.EPCISDocument.JSON.Map(docXmlStr);
This example is for reading an EPCIS Query Document, but it would work the same with EPCIS Document as well.
// read the EPCIS 1.2 XML string
EPCISQueryDocument doc = OpenTraceabilityMappers.EPCISQueryDocument.XML.Map(queryDocXmlStr_1_2);
// set the EPCIS version
doc.EPCISVersion = EPCISVersion.V2;
// write it back out now
string queryDocXmlStr_2_0 = OpenTraceabilityMappers.EPCISQueryDocument.XML.Map(doc);
This example is for reading an EPCIS Query Document, but it would work the same with EPCIS Document as well.
// read the EPCIS 1.2 XML string
EPCISQueryDocument doc = OpenTraceabilityMappers.EPCISQueryDocument.XML.Map(queryDocXmlStr_1_2);
// set the EPCIS version
doc.EPCISVersion = EPCISVersion.V2;
// write it back out now
string queryDocJsonStr_2_0 = OpenTraceabilityMappers.EPCISQueryDocument.JSON.Map(doc);
We support querying traceability and master data using a very specific flavor of communication protocols from GS1.
GET - /events endpoint on the EPCIS 2.0 Query Interface.The first interface that can be queried is for events from an EPCIS 2.0 Query Interface at the GET - /events endpoint.
This is done using the EPCISTraceabilityResolver class.
In order to use this, you need:
EPCISQueryInterfaceOptions
EPCISQueryParameters
using HttpClient = new HttpClient();
EPCISQueryInterfaceOptions options = new EPCISQueryInterfaceOptions()
{
URL = new Uri(url),
Format = _format,
Version = _version,
EnableStackTrace = true
};
EPC epc = new EPC("urn:epc:id:sgtin:0614141.107346.2019");
EPCISQueryParameters parameters = new EPCISQueryParameters(epc);
return await EPCISTraceabilityResolver.QueryEvents(options, parameters, client);
You can also use the trace-back feature to automatically trace-back the EPC.
using HttpClient = new HttpClient();
EPCISQueryInterfaceOptions options = new EPCISQueryInterfaceOptions()
{
URL = new Uri(url),
Format = _format,
Version = _version,
EnableStackTrace = true
};
EPC epc = new EPC("urn:epc:id:sgtin:0614141.107346.2019");
return await EPCISTraceabilityResolver.Traceback(options, epc, client);
You can also resolve master data from a GS1 Digital Link resolver with the MasterDataResolver class. This class
takes in a DigitalLinkQueryOptions object that contains the URL of the resolver and also an EPCISBaseDocument
and will search the EPCISBaseDocument for any master data that is not in the document but referenced in the events,
and try and resolve it and add it to the document.
DigitalLinkQueryOptions options = new DigitalLinkQueryOptions()
{
URL = new Uri(url),
EnableStackTrace = true
};
await MasterDataResolver.ResolveMasterData(options, doc, client);
You can always look in our unit tests for more examples of how to use the library.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on OpenTraceability:
| Package | Downloads |
|---|---|
|
OpenTraceability.GDST
Open source libraries for working with EPCIS in C# with extensions for GDST. |
|
|
OpenTraceability.TestServerPackage
A packaged version of a test server that can be deployed and used prop up a dummy EPCIS/Digital Link resolver.. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0-beta.99 | 58 | 6/10/2026 |
| 2.0.0-beta.98 | 63 | 6/8/2026 |
| 2.0.0-beta.97 | 63 | 6/4/2026 |
| 2.0.0-beta.96 | 63 | 5/15/2026 |
| 1.5.84 | 642 | 4/16/2026 |
| 1.5.83 | 310 | 4/15/2026 |
| 1.5.82 | 1,288 | 12/29/2025 |
| 1.5.81 | 1,719 | 12/1/2025 |
| 1.5.80 | 794 | 10/10/2025 |
| 1.5.79 | 377 | 10/10/2025 |
| 1.5.78 | 379 | 10/10/2025 |
| 1.4.75 | 6,278 | 4/14/2025 |
| 1.4.72 | 711 | 4/1/2025 |
| 1.4.71 | 1,779 | 1/30/2025 |
| 1.4.69 | 1,816 | 12/18/2024 |
| 1.4.68 | 462 | 12/13/2024 |
| 1.4.67 | 574 | 12/5/2024 |
| 1.4.66 | 2,694 | 10/5/2024 |
| 1.4.64 | 398 | 10/4/2024 |
| 1.4.63 | 421 | 10/4/2024 |