Standardised.Vessel.Dataset 2.1.0

dotnet add package Standardised.Vessel.Dataset --version 2.1.0
                    
NuGet\Install-Package Standardised.Vessel.Dataset -Version 2.1.0
                    
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="Standardised.Vessel.Dataset" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Standardised.Vessel.Dataset" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Standardised.Vessel.Dataset" />
                    
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 Standardised.Vessel.Dataset --version 2.1.0
                    
#r "nuget: Standardised.Vessel.Dataset, 2.1.0"
                    
#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 Standardised.Vessel.Dataset@2.1.0
                    
#: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=Standardised.Vessel.Dataset&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Standardised.Vessel.Dataset&version=2.1.0
                    
Install as a Cake Tool

Installation

You can install the package via NuGet Package Manager Console:

Install-Package Standardised.Vessel.Dataset

Or using .NET Core CLI

dotnet add package Standardised.Vessel.Dataset

Usage

To get started with the library, you can use the following code snippet:


using StandardisedVesselDataset.Exporters.Formats.XML;
using StandardisedVesselDataset.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SimpleExporter;
using System.Xml.Serialization;
using StandardisedVesselDataset.Models;

var builder = Host.CreateApplicationBuilder(args);

//register package DI (Dependency injection) services
builder.Services.AddSvd();
builder.Services.AddCustomValidator<ExtendedStandardisedVesselDatasetValidator>();

using var host = builder.Build();

await ExportAsync(host.Services.GetRequiredService<ISvdXmlExporter>());


await host.RunAsync();


static async Task ExportAsync(ISvdXmlExporter exporter)
{
    //Load Data
    var vesselReportData = LoadVesselReportData();

    //Map
    var svdData = MapToSvd(vesselReportData);
    
    //Export
    var reportContent = await exporter.ExportAsync(svdData);

    Console.WriteLine($"Writing file to: {reportContent.FileName}");
    await File.WriteAllBytesAsync(reportContent.FileName, reportContent.Content);
}

static VesselReportData LoadVesselReportData()
{
    var filePath = Path.Combine("Data", "report.xml");
    using var reader = new StreamReader(filePath);
    var serializer = new XmlSerializer(typeof(VesselReportData));
    return (VesselReportData)serializer.Deserialize(reader);
}

static StandardisedVesselDataset.Models.StandardisedVesselDataset MapToSvd(VesselReportData vesselData)
{
    return new StandardisedVesselDataset.Models.StandardisedVesselDataset()
    {
        General = new GeneralInformation()
        {
            Imo = vesselData.VesselImo,
            ShipName = vesselData.VesselName,
            ShipReportingDate = vesselData.ReportDate,
        },
        PortAndRoute = new PortInformation()
        {
            DeparturePortCode = vesselData.DeparturePort,
            DeparturePortDescription = vesselData.DeparturePortDescription,
            ArrivalPortCode = vesselData.DestinationPort,
            ArrivalPortDescription = vesselData.DestinationPortDescription
        }
    };
}

Validation

As the Standardised Vessel DataSet (SVD) model is still in its early phases, and adoption by companies may vary, we aim to be flexible with validation to accommodate different use cases. We understand that the sector might have unique requirements or variations in their data.

To provide a customizable solution, we have included an extensibility point for validation. You can easily extend our default validator and add your own rules that align with your specific needs. Below is an example of how you can create and register a custom validator:

Create your custom validator:

using StandardisedVesselDataset.Validators;

namespace StandardisedVesselDataset.Example
{
    internal class ExtendedStandardisedVesselDatasetValidator : StandardisedVesselDatasetValidator
    {
        public ExtendedStandardisedVesselDatasetValidator()
        {
            //extend rules here
        }
    }
}

Register the validator into the DI container:

//Register
builder.Services.AddSvd();
builder.Services.AddCustomValidator<ExtendedStandardisedVesselDatasetValidator>();
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 211 6/2/2025
2.0.0 194 5/9/2024
1.0.0 194 4/11/2024
0.5.0 183 4/4/2024
0.4.0-dev-2 193 4/3/2024 0.4.0-dev-2 is deprecated.
0.4.0-dev-1 188 4/3/2024 0.4.0-dev-1 is deprecated.
0.4.0-dev 198 4/3/2024 0.4.0-dev is deprecated.