How to upgrade from the Trial? (Legacy)

NOTE:

This article is applicable only to trials downloaded before December 21, 2020, and EdiFabric versions before 10.0.0.

  1. Uninstall all trial NuGet packages (all NuGet packages from nuget.org are trials and will expire in ~14 days) from all projects and solutions:
  • EdiFabric.Core
  • EdiFabric.Framework
  • EdiFabric.Plugins.Ack.Edifact
  • EdiFabric.Plugins.Ack.X12
  • EdiFabric.Templates.Edifact
  • EdiFabric.Templates.X12
  • EdiFabric.Templates.Hipaa
  • EdiFabric.Templates.Padis
  • EdiFabric.Templates.Vda
  1. Download EdiFabric.Tools.Enterprise/EdiFabric.Tools.Professional and EdiFabric.Templates.Enterprise/EdiFabric.Templates.Professional by using the download link in the order email.
  2. Unzip EdiFabric.Tools.Enterprise/EdiFabric.Tools.Professional and either publish the full NuGet packages to your internal NuGet server (How to setup internal NuGet Hosting), or reference the DLLs directly from your startup project:
    • EdiFabric.Core.Full
    • EdiFabric.Framework.Full
    • EdiFabric.Plugins.Ack.Edifact.Full
    • EdiFabric.Plugins.Ack.X12.Full
  3. Unzip EdiFabric.Templates.Enterprise/EdiFabric.Templates.Professional, select the transactions\versions you want to work with, and pack them together in a new project(s).
  4. Add project reference(s) to the project(s) created in the previous step in the startup project. Skip this step if you are adding the templates to the startup project instead of a separate library project(s).

Note: Please ensure that all previous installations of the trial packages were successfully removed from all packages folders. In .NET Core the packages location is: %UserProfile%\.nuget\packages

Below is a step by step guide on how to design your projects from scratch. It is assumed that you have removed all references/packages from nuget.org before starting it.

  • Place all NuGet packages (the .nupkg files) in your internal NuGet server/folder. If you don't have one, use any folder:

mceclip0.png

  • Create a class library project, regardless of whether it is .NET Core or .NET Framework, the NuGet package will resolve itself to the correct target.

mceclip1.png

  • Add only the EDI templates you plan to use (in this example it is IFTMIN, version D95B, standard EDIFACT), together with the common files to that project as existing files:

mceclip2.png

The common files are the 5 files always ending with:

_Codes.cs

_ComplexElementInterfaces.cs

_ComplexElements.cs

_SegmentInterfaces.cs

_Segments.cs

  • (Optional, for .NET Framework only) Add references to:

System.Runtime.Serialization and System.Xml.Serialization.

  • (Optional) Create a new package source in Visual Studio (this step is not required if you have already configured one).

Select Manage NuGet Packages:

mceclip3.png

then Package source settings:

mceclip4.png

then click the "plus" button to add a new one:

mceclip5.png

then change the Name, and then the source to the folder you placed the .nupkg files in the first step:

mceclip6.png

then click OK, you should now have your new NuGet package source available:

mceclip7.png

 

  • Install EdiFabric.Core.Full package to the class library project:

Select Manage NuGet Packages:

mceclip3.png

Select the package source, then the EdiFabric.Core.Full package, and finally click Install:

mceclip8.png

Check if it was installed correctly:

mceclip9.png

Rebuild the project, there should be no errors.

This is the pattern to create EDI templates projects, you can have as many as you wanted, and each can have duplicate templates. This allows you to amend the templates according to your partner-specific requirements without introducing unwanted or breaking changes.

  • Create a console app project (or add to your existing executable project), regardless of whether it is .NET Core or .NET Framework, the NuGet package will resolve itself to the correct target. This is where your EDI operations will be executed, such as reading/writing/validating, etc.

mceclip10.png

  • Install EdiFabric.Framework.Full package to the console app project.

Select the package source, then the EdiFabric.Framework.Full package, and finally click Install:

mceclip12.png

Check if it was installed correctly:

mceclip13.png

  • Add a project reference to the class library project, the final project structure should look like:

mceclip14.png

  • Open Program.cs file, and paste the following code, and change the path to point to an existing file:
using EdiFabric.Framework.Readers;
using System.IO;

namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var edi = File.OpenRead(@"C:\test.txt"); // use X12Reader for X12 files, and VdaReader for VDA files, instead of // EdifactReader using (var ediReader = new EdifactReader(edi, "ClassLibrary1"))
{
var result = ediReader.ReadToEnd();
}
}
}
}
  • Note that the second parameter of the EdifactReader is the name of the class library project, therefore change it to the name of your class library project. This allows you to change this name per trading partner and load the corresponding class library for each partner, assuming that there is a correlation between the source of the EDI file to be read, and the name of the EDI templates project that matches that source (trading partner).

mceclip15.png

  • It is possible to move all EDI templates into the console app project, and completely omit the second reader parameter, however, this is only recommended for small POC projects. If you don't specify the templates project, the framework will look for the EDI templates in the executing project.
  • The example above is for EDIFACT, if you use X12 or VDA, use X12Reader or VdaReader instead of EdifactReader.
  • When you are using the DLLs instead of the NuGet packages, the steps are the same, simply use the DLL files instead of packages. The only additional bit is to also add a reference to EdiFabric.Core.Full in your console app (executable) project, which is otherwise automatically installed by the package.
Was this article helpful?
2 out of 2 found this helpful