OpenTraceability 1.5.80

dotnet add package OpenTraceability --version 1.5.80
                    
NuGet\Install-Package OpenTraceability -Version 1.5.80
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OpenTraceability" Version="1.5.80" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenTraceability" Version="1.5.80" />
                    
Directory.Packages.props
<PackageReference Include="OpenTraceability" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OpenTraceability --version 1.5.80
                    
#r "nuget: OpenTraceability, 1.5.80"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OpenTraceability@1.5.80
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OpenTraceability&version=1.5.80
                    
Install as a Cake Addin
#tool nuget:?package=OpenTraceability&version=1.5.80
                    
Install as a Cake Tool

Open Traceability (C#)

This is an open-source library for handling traceability data in .NET using C#.

Release Notes

Version 1.4

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.

  • Added support for .Net Standard 2.0

Setup

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:

  • OpenTraceability.GDST

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.

Models

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)

EPCIS Query Document / EPCIS Document

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.

EPCIS Document Header

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.DummyHeader to get a dummy header that you can use to pass schema validation for the XML formats.

Mapping

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.

Reading EPCIS 1.2 XML

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);

Reading EPCIS 2.0 XML

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);

Reading EPCIS 2.0 JSON-LD

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);

Convert EPCIS 1.2 XML to EPCIS 2.0 XML

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);

Convert EPCIS 1.2 XML to EPCIS 2.0 JSON-LD

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);

Querying for Data

We support querying traceability and master data using a very specific flavor of communication protocols from GS1.

  • We support querying for event data using the GET - /events endpoint on the EPCIS 2.0 Query Interface.
  • We support resolving master data from a GS1 Digital Link Resolver using the GS1 Web Vocab JSON-LD format.

EPCIS 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

    • URL
    • Version
    • Format
  • EPCISQueryParameters

    • Here you can define one or more parameters for filtering the desired results.
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);

Finally

You can always look in our unit tests for more examples of how to use the library.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

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..

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.80 329 10/10/2025
1.5.79 171 10/10/2025
1.5.78 174 10/10/2025
1.4.75 4,898 4/14/2025
1.4.72 515 4/1/2025
1.4.71 1,563 1/30/2025
1.4.69 1,616 12/18/2024
1.4.68 269 12/13/2024
1.4.67 368 12/5/2024
1.4.66 2,490 10/5/2024
1.4.64 192 10/4/2024
1.4.63 209 10/4/2024
1.4.62 211 10/3/2024
1.4.61 1,021 7/30/2024
1.4.60 206 7/26/2024
1.4.59 1,705 6/25/2024
1.4.58 1,107 5/31/2024
1.4.57 428 5/22/2024
1.4.56 1,423 4/17/2024
1.3.55 371 4/15/2024
1.3.54 770 2/6/2024
1.3.53 412 2/4/2024
1.2.14 363 2/2/2024
1.2.13 342 2/2/2024
1.2.12 1,166 11/29/2023
1.2.11 795 7/14/2023
1.2.10 658 7/10/2023
1.2.9 623 7/10/2023
1.2.8 601 7/7/2023
1.2.7 730 7/6/2023
1.2.7-beta86 573 7/6/2023
1.2.6 560 7/5/2023
1.2.6-beta85 554 7/5/2023
1.2.5 636 6/29/2023
1.2.5-beta84 543 7/5/2023
1.2.5-beta83 644 6/29/2023
1.2.4 644 6/28/2023
1.2.4-beta82 540 6/29/2023
1.2.4-beta80 541 6/29/2023
1.2.4-beta79 582 6/28/2023
1.2.4-beta78 630 6/28/2023
1.2.4-beta77 564 6/28/2023
1.2.4-beta76 596 6/28/2023
1.2.4-beta75 609 6/28/2023
1.2.4-beta74 580 6/28/2023
1.2.4-beta73 579 6/28/2023
1.2.4-beta72 544 6/28/2023
1.2.4-beta71 557 6/28/2023
1.2.4-beta70 554 6/28/2023
1.2.4-beta69 576 6/28/2023
1.2.4-beta68 552 6/28/2023
1.2.4-beta67 640 6/28/2023
1.2.4-beta66 641 6/28/2023
1.2.4-beta65 541 6/28/2023
1.2.4-beta64 609 6/28/2023
1.2.4-beta63 623 6/28/2023
1.2.4-beta62 598 6/28/2023
1.2.4-beta61 613 6/28/2023
1.2.4-beta60 654 6/28/2023
1.2.4-beta59 569 6/28/2023
1.2.4-beta58 631 6/28/2023
1.2.4-beta57 556 6/28/2023
1.2.4-beta56 620 6/28/2023
1.2.4-beta55 618 6/28/2023
1.2.4-beta54 535 6/28/2023
1.2.3 733 6/15/2023
1.2.2 674 6/13/2023
1.2.2-beta53 569 6/28/2023
1.2.2-beta52 608 6/28/2023
1.2.2-beta51 561 6/28/2023
1.2.2-beta50 591 6/28/2023
1.2.2-beta49 563 6/28/2023
1.2.2-beta48 626 6/28/2023
1.2.2-beta47 596 6/28/2023
1.2.2-beta46 618 6/28/2023
1.2.2-beta45 623 6/28/2023
1.2.2-beta44 594 6/28/2023
1.2.2-beta43 583 6/23/2023
1.2.2-beta42 610 6/23/2023
1.2.2-beta41 609 6/23/2023
1.2.2-beta40 606 6/23/2023
1.2.2-beta39 615 6/23/2023
1.2.2-beta38 641 6/23/2023
1.2.2-beta37 635 6/13/2023
1.2.1 724 5/23/2023
1.2.1-beta36 609 6/13/2023
1.2.1-beta35 576 5/23/2023
1.2.0 646 5/23/2023
1.2.0-beta34 600 5/23/2023
1.2.0-beta33 547 5/23/2023
1.1.9 694 5/12/2023
1.1.9-beta32 620 5/12/2023
1.1.8 685 5/12/2023
1.1.8-beta31 631 5/12/2023
1.1.7 618 5/12/2023
1.1.7-beta30 579 5/12/2023
1.1.6 586 5/8/2023
1.1.6-beta29 561 5/8/2023
1.1.5 615 5/8/2023
1.1.5-beta28 590 5/8/2023
1.1.5-beta27 619 5/8/2023
1.1.4 684 5/8/2023
1.1.4-beta26 579 5/8/2023
1.1.3 618 5/7/2023
1.1.3-beta25 568 5/8/2023
1.1.3-beta24 567 5/7/2023
1.1.2 624 5/5/2023
1.1.2-beta23 577 5/7/2023
1.1.2-beta22 540 5/5/2023
1.1.1 602 5/4/2023
1.1.1-beta20 569 5/4/2023
1.1.0 628 5/4/2023
1.1.0-beta19 576 5/4/2023
1.0.8 673 5/4/2023
1.0.8-beta18 574 5/4/2023
1.0.8-beta17 507 5/4/2023
1.0.7 666 5/3/2023
1.0.7-beta14 579 5/3/2023
1.0.6 641 5/3/2023
1.0.6-beta13 522 5/3/2023
1.0.5 621 5/3/2023
1.0.5-beta12 588 5/3/2023
1.0.5-beta11 538 5/3/2023
1.0.4 616 5/3/2023
1.0.4-beta9 515 5/3/2023
1.0.4-beta10 546 5/3/2023
1.0.2 690 5/3/2023
1.0.2-beta8 603 5/3/2023
1.0.1 645 5/3/2023
1.0.0 658 4/20/2023
1.0.0-beta9 548 4/20/2023
1.0.0-beta5 537 4/30/2023
1.0.0-beta4 563 4/20/2023
1.0.0-beta1 498 4/20/2023
1.0.0-beta 484 4/20/2023