Skip to content

AVEVA/sample-adh-csv_to_adh-dotnet

Repository files navigation

CSV to Cds sample

Version: 1.4.8

Build Status

Developed against DotNet 6.0.

About this sample

| 📢 Notice: The PI Adapter for Structured Data Files can send CSVs (and other files types) to EDS, Cds, and PI. The released adapter is recommended for use if you need to send .csv data, but this sample is available if you need to build your own solution.|

This sample sends data from a passed in csv file or from the datafile.csv file local to the application to Cds. This sample uses the Authentication flow to authenticate against Cds. By default it will create the type and the streams used in the default datafile.csv. When testing it will check the values to make sure they are saved on Cds and it will delete whatever it added to the system at the end.

Running this sample

In this example we assume that you have the dotnet core CLI.

Prerequisites

  • Register an Authorization Code client in Cds and ensure that the registered client in Cds contains https://127.0.0.1:54567/signin-oidc in the list of RedirectUris. For details on this please see this video
  • Configure the sample using the file appsettings.placeholder.json. Before editing, rename this file to appsettings.json. This repository's .gitignore rules should prevent the file from ever being checked in to any fork or branch, to ensure credentials are not compromised.
  • Replace the placeholders in the appsettings.json file with your Tenant Id, NamespaceId, and Client Id. The username and password fields are used for testing and can be left as is.

Configure constants for connecting and authentication

Please update the appsettings.json file with the appropriate information as shown below. This sample leverages PKCE login, so that way the user running this application has appropriate authorization.

{
  "NamespaceId": "PLACEHOLDER_REPLACE_WITH_NAMESPACE_ID",
  "TenantId": "PLACEHOLDER_REPLACE_WITH_TENANT_ID",
  "Resource": "https://uswe.datahub.connect.aveva.com",
  "ApiVersion": "v1",
  "ClientId": "PLACEHOLDER_REPLACE_WITH_CLIENT_ID"
}

Using Command Line

To run this example from the commandline run:

dotnet restore
dotnet run

To test this program change directories to the test and run:

dotnet restore
dotnet test

For the main Cds samples page ReadMe
For the main AVEVA samples page ReadMe

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages