Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Comment thread
dixonjoel marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on:
push:
branches: [main, releases/**]
pull_request:
branches: [main, releases/**]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
name: Build on Windows
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
Comment thread
dixonjoel marked this conversation as resolved.
with:
dotnet-version: '8.0.x'
- name: Build examples
run: dotnet build examples/Examples.slnx

- name: Check formatting (examples)
if: always()
run: dotnet format examples/Examples.slnx --verify-no-changes

- name: Build metadata-builder
if: always()
run: dotnet build metadata-builder/MetadataBuilder.slnx

- name: Check formatting (metadata-builder)
if: always()
run: dotnet format metadata-builder/MetadataBuilder.slnx --verify-no-changes
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
# Datastore .NET Examples

This repo contains the source code for examples that show how to use the .NET API of NI Measurement Data Services.
These examples do not go through any build process, you can simply copy them to a system that has the necessary
software installed.
This repo contains the source code for examples that show how to use the .NET API of NI Measurement Data Services. These examples do not go through any build process, you can simply copy them to a system that has the necessary software installed.

## Running the Examples

1. Clone or download this repository.
2. Copy the contents of `Examples` to a system that has NI Measurement Data Services and the .NET framework installed.
2. Copy the contents of `examples` to a system that has NI Measurement Data Services including .NET installed.
3. Compile and run the console applications defined in the .csproj files in the `Examples` directory.
4. Be aware that running these examples will publish data to the default datastore location on your system. Data that is
published by a certain example may show up in queries from other examples or from your own Measurement Data Services application.
4. Running these examples will publish data to the `examples/temp_data` folder in the repo.

## Installation

As a prerequisite to using the DataStore .NET API, you must install Measurement Data Services
Software 2026 Q1 or later on your system. You can download and install this software using
[NI Package Manager](https://www.ni.com/en/support/downloads/software-products/download.package-manager.html).
As a prerequisite to using the DataStore .NET API, you must install Measurement Data Services Software 2026 Q1 or later on your system. You can download and install this software using [NI Package Manager](https://www.ni.com/en/support/downloads/software-products/download.package-manager.html).
6 changes: 3 additions & 3 deletions examples/DataStoreContext/DataStoreContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DataStoreContext : IDisposable
private const string DataStoreIngestDirectoryPathEnvVar = "NIDATASTORE_DATASTORESETTINGS__INGESTDIRECTORY";
private const string DataStoreFailedIngestDirectoryPathEnvVar = "NIDATASTORE_DATASTORESETTINGS__FAILEDINGESTDIRECTORY";
private const string DataStoreTdmsExpirationSecondsEnvName = "NIDATASTORE_DATASTORESETTINGS__TDMSFILECACHEEXPIRATIONSECONDS";

private const string DefaultFolderName = "temp_data";

private readonly string? _baseDirectoryPath;
Expand Down Expand Up @@ -112,12 +112,12 @@ private string GetBaseDirectoryHash()
{
string baseDirectoryPath = GetBaseDirectoryPath();
string resolvedPath = Path.GetFullPath(baseDirectoryPath);

using (var sha256 = SHA256.Create())
{
byte[] pathBytes = Encoding.UTF8.GetBytes(resolvedPath);
byte[] hashBytes = sha256.ComputeHash(pathBytes);

// Convert to hex string and take first 32 characters
StringBuilder sb = new StringBuilder();
for (int i = 0; i < Math.Min(16, hashBytes.Length); i++)
Expand Down
2 changes: 1 addition & 1 deletion examples/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageVersion Include="NationalInstruments.SystemConfiguration.x64" Version="26.0.49263" />
<PackageVersion Include="NI.DataStore.V1" Version="9.21.0.2575-ci.2606161932" />
<PackageVersion Include="NI.DataStore.V1" Version="9.21.0.2789-ci.2606282138" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion examples/Extension Attributes/Extension Attributes.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using NationalInstruments;
using NationalInstruments.DataStore.Utilities;
using NationalInstruments.DataStore.Utilities;
using NationalInstruments.MeasurementLink.Discovery.V1;
using NationalInstruments.Measurements.Data.V1;
using NationalInstruments.Measurements.Metadata.V1;
Expand Down
4 changes: 2 additions & 2 deletions metadata-builder/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="NI.Discovery.V1.Client" Version="9.21.0.2146" />
<PackageVersion Include="NI.Measurements.MetadataBuilder" Version="9.21.0-ci.2606081500" />
<PackageVersion Include="NI.Discovery.V1.Client" Version="9.21.0.2789" />
<PackageVersion Include="NI.Measurements.MetadataBuilder" Version="9.21.0.2789-ci.2606282318" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>

<packageSourceMapping>
<clear />
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>

<config>
<add key="httpTimeout" value="180" />
</config>
</configuration>
Loading