Skip to content

EdifactMessageCustomizerCLI en

Leksiqq edited this page Apr 6, 2024 · 4 revisions

Attention! This article, as well as this announcement, are automatically translated from Russian.

Class EdifactMessageCustomizerCLI

Preparing a command line application for editing the specification of a standard message for the needs of an agreed exchange between specific parties. This includes reducing the set of segments used and changing data limits.

Customization is carried out using a script, which is an XML schema of a special structure. More...

When customizing, a copy of the original XML schema is created with the suffix specified in the script added to its name, and all changes are made in this copy. Thus, the standard XML schema remains unchanged.

Methods

  • public static async Task RunAsync(string[] args, Action<IHostApplicationBuilder>? configHostBuilder = null, Action<IServiceProvider>? configApp = null) - called when the executable starts and does all the work.

In the case where the EDIFACT XML schema directory and script are located on the local file system, no additional actions are required. That is, when using top-level operators, the entire application code looks like this:

using Net.Leksi.Edifact;

await EdifactMessageCustomizerCLI.RunAsync(args);

If, for example, the EDIFACT XML schema directory or script is located in the cloud, then additional arguments must be used:

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Net.Leksi.Edifact;
using Net.Leksi.Streams;

await EdifactMessageCustomizerCLI.RunAsync(args, ConfigHostBuilder);

void ConfigHostBuilder(IHostApplicationBuilder builder)
{
     builder.Services.AddKeyedSingleton<IStreamFactory, S3FileStreamFactory>("s3");
}

After this, you can use a Uri like: s3://bucket/path. (The S3FileStreamFactory class is given as an example; if necessary, you should implement it yourself, or write an adapter to some existing functionality)

The configApp argument should be used if any additional configuration of the added factory is required using previously injected dependencies.

Launch and command line options

When running a compiled application without parameters, we get brief instructions:

2024-04-06_14-28-42

Review | To the top of the page

Clone this wiki locally