Documentation

Install

Article author
Admin
  • Updated

EdiFabric 11.0.0 is a NuGet package. Install it from nuget.org, add the template package for the EDI standard you are evaluating, then call License.SetSerial with your Community serial key.

EdiFabric on NuGet   Sign up free for Community

Install from nuget.org

From the project directory:

dotnet add package EdiFabric
dotnet add package EdiFabric.Templates.X12

In Visual Studio, open Tools → NuGet Package Manager → Package Manager Console and run:

Install-Package EdiFabric
Install-Package EdiFabric.Templates.X12

Swap the template package for the standard you need. These packages are for evaluation on the Community plan. Paid plans ship the same models as C# source. See How to create EDI template projects.

Standard Package
X12 EdiFabric.Templates.X12
HIPAA EdiFabric.Templates.Hipaa
EDIFACT, plus Padis and Edigas where a sample needs them EdiFabric.Templates.Edifact
HL7 EdiFabric.Templates.Hl7
NCPDP Telecommunication and SCRIPT EdiFabric.Templates.Ncpdp
IATA PADIS EdiFabric.Templates.Padis
VDA EdiFabric.Templates.Vda
EDIGAS EdiFabric.Templates.Edigas

Flat-file samples do not use a template package. The models are C# classes in the FlatFile.NET examples.

The package targets .NET 8, .NET 9, .NET 10, and .NET Framework 4.8. Pick the target that matches your project. The example solutions ship as net6.0 and net48. To try a later .NET, change TargetFramework and rebuild.

Restore and build:

dotnet restore
dotnet build

Apply the serial key

Sign up free for Community and copy the serial from Your Account. Call this before any parse, generate, validate, or acknowledge. The same serial covers ediFabric .NET, Native, and Cloud on that plan.

// Community
License.SetSerial(serial);

// Developer: 1-day cache; refreshes if the token expires within N seconds
License.EnsureToken(serial, seconds: 3600);

// Enterprise: offline token
License.SetToken(token);

In the examples, paste the serial into TrialSerialKey in Config.cs (for X12, NET Framework 4.8/EdiFabric.Examples.X12.Common/Config.cs). The .NET 6 projects link that file. The examples call License.SetSerial(Config.TrialSerialKey).

Community is 250 operations per day, non-production, and never expires. One operation is one parse, generate, validate, or acknowledge call. Past the quota, calls throw LicenseException with error 639. Error 635 means the serial was never set.

Read a file

using EdiFabric.Core.Model.Edi;
using EdiFabric.Framework.Readers;
using EdiFabric.Templates.X12004010;

License.SetSerial(serial);

var ediStream = File.OpenRead(@"Files\X12\PurchaseOrders.txt");

List<IEdiItem> ediItems;
using (var ediReader = new X12Reader(ediStream, "EdiFabric.Templates.X12"))
    ediItems = ediReader.ReadToEnd().ToList();

var purchaseOrders = ediItems.OfType<TS850>();

Or clone X12.NET and run the demo, which already references these packages:

cd "NET 6/EdiFabric.Examples.X12.Demo"
dotnet run

Install from a local folder

Use this when the machine cannot reach nuget.org. Download the examples ZIP and unzip it. The package is EdiFabric.X.X.X.nupkg in EdiFabric.Sdk\NuGet.

  1. In Visual Studio go to Tools → NuGet Package Manager → Package Manager Settings → Package Sources.

    Package Sources in Visual Studio

  2. Click the green plus button, name the source, and set Source to the EdiFabric.Sdk\NuGet folder. Click Update, then OK.

    EdiFabric folder added as a package source

  3. Right-click the project and select Manage NuGet Packages.

    Manage NuGet Packages on the project

  4. Select the EdiFabric package source, select EdiFabric, and click Install.

    EdiFabric package source selected

    Install the EdiFabric package

From the CLI, point a restore at that folder:

dotnet add package EdiFabric --source "C:\path\to\EdiFabric.Sdk\NuGet"

Microsoft’s guide to installing NuGet packages in Visual Studio covers the same dialogs.

Add a DLL reference

Reference the assembly whose target matches the project: .NET 8, .NET 9, .NET 10, or .NET Framework 4.8. The assemblies are in the examples ZIP next to the nupkg. A project that uses PackageReference should install the NuGet package instead of mixing in a loose DLL.

Share this:

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.