RPS.Dashboard.DataMan 1.0.0

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

RPS.Dashboard.DataMan

DataManContext, its entities and entity configurations for the RPS Dataman database, packaged so applications can read and write Dataman without referencing Dashboard.Data (and, through it, every other application's data layer).

.NET 10, EF Core 10, SQL Server.

Interim package. Applications use this to access Dataman directly until the Dashboard API replaces it. Prefer the API once it exists.

What's in it

Namespace Contents
Dashboard.Data.Models DataManContext and the entity classes (Employee, Organization, ConsolidatedDocket, Site, …)
Dashboard.Data.Models.Configurations IEntityTypeConfiguration<T> table mappings
Dashboard.Data AddDataManContext registration extension; AuditInterceptor<T>, IdentityInsertInterceptor; IUsernameContext, IIdentityInsertContext (implemented by DataManContext)

The types keep the namespaces they had in Dashboard, so Dashboard's migrations and the code that uses these types did not change when it switched to this package.

Dependencies: Microsoft.EntityFrameworkCore.SqlServer, Centeva.Auditing, Centeva.InterfaceRecord, Centeva.PrincipalProvider (plus a pin of System.Security.Cryptography.Pkcs to a patched version). No references to any application project, and nothing that migrates or seeds a database.

Using the package

Install

The package is published to nuget.org, so no extra feed or credentials are needed. Reference it:

<PackageReference Include="RPS.Dashboard.DataMan" Version="x.y.z" />

Connection string

Use a connection string named Dataman:

"ConnectionStrings": {
  "Dataman": "Server=...;Database=DataMan;..."
}

Register the context

using Dashboard.Data;

services.AddDataManContext(configuration);

This registers DataManContext (scoped) on SQL Server with the audit and identity-insert interceptors attached. It only calls AddDbContext: it does not migrate, seed, or register anything else. If your app uses a different name for the Dataman connection string, pass it: services.AddDataManContext(configuration, connectionStringName: "DataMan").

Register your application's IPrincipalProvider (Centeva.PrincipalProvider) as well so audit rows record the current user; see Auditing.

Then inject DataManContext where you need it:

public class MyService(DataManContext dataMan)
{
    public Task<Employee> FindEmployee(string lanId) =>
        dataMan.Employees.SingleOrDefaultAsync(e => e.LanId == lanId);
}

Name clashes

Entity names such as Employee, Organization and Site may also exist in your own data layer. Use an alias where both are needed:

using DM = Dashboard.Data.Models;

DM.Employee employee = await dataMan.Employees.FirstAsync();

Auditing

Dataman tables are audited by SQL Server triggers. The model declares an audit trigger on every table, so EF always generates trigger-compatible SaveChanges SQL, and your inserts, updates and deletes are recorded by the triggers automatically.

The username on each audit row comes from CONTEXT_INFO, which AuditInterceptor (registered by AddDataManContext) sets before each command. It uses, in order:

  1. DataManContext.ContextUsername, if set explicitly, e.g. ((IUsernameContext)dataMan).SetContextUsername("TaskRunner") for jobs and seeders;
  2. otherwise, if your app registers an IPrincipalProvider, the current user's identity name (LAN ID), then email, then application ID;
  3. otherwise nothing, and the write is audited without a username.

AddDataManContext gives the interceptor the request's IPrincipalProvider from DI; no extra wiring is needed.

IdentityInsertInterceptor (also registered by AddDataManContext) supports ((IIdentityInsertContext)dataMan).EnableIdentityInsert(entityType) for inserting explicit identity values.

Do not migrate

This package contains no migrations and no seeders, and nothing in it runs them. Dashboard owns the Dataman schema and is the only application that migrates it.

Applications consuming this package must not:

  • call Database.Migrate() or Database.EnsureCreated() on DataManContext;
  • run dotnet ef migrations add against DataManContext;
  • register DataManContext with Centeva.DatabaseMaintenance or any other migrator/seeder.

Maintaining the package

Changing the Dataman model

The model now lives here, not in Dashboard. A schema change takes both repos:

  1. This repo: change the entity and/or configuration, build, run the tests, and release a new version.

  2. Dashboard: bump RPS.Dashboard.DataMan in Dashboard.Data.csproj, then add the migration in Dashboard, which keeps the migrations in Dashboard.Data via MigrationsAssembly("Dashboard.Data"):

    cd server
    dotnet ef migrations add <Name> --project src/Dashboard.Data --startup-project src/Dashboard.Application --context DataManContext
    
  3. Applications pick up the change by bumping their package version.

For a change that should not alter the schema, confirm in Dashboard after bumping the package:

dotnet ef migrations has-pending-model-changes --project src/Dashboard.Data --startup-project src/Dashboard.Application --context DataManContext

It should report no changes.

The tests in test/RPS.Dashboard.DataMan.Tests check that the package has no application or migration-tool references, ships no migrations, that AddDataManContext uses the Dataman connection string, attaches both interceptors and registers no migrators or seeders, that the audit username falls back to a registered IPrincipalProvider (per scope, without EF building a new service provider per request), and that the model declares an audit trigger on all 29 Dataman tables (matching Dashboard's model snapshot). Update the table count when adding or removing a table.

Keep the four-argument (options, principal, IConfiguration, AuditIgnore[]) DataManContext constructor internal. DI only uses public constructors, so every app gets (options). Configuration and AuditIgnore[] change the model; if that constructor were public, DI would select it in Dashboard (which registers AuditIgnore[]), changing the audit triggers and Dashboard's migration snapshot.

Build and test

dotnet build
dotnet test

Try a change locally

Pack to the shared LocalNuget folder with a unique pre-release version (NuGet caches by version), then reference that version from Dashboard with LocalNuget as a package source:

dotnet pack src/RPS.Dashboard.DataMan/RPS.Dashboard.DataMan.csproj -c Release -o ../LocalNuget /p:Version=0.1.0-local.<N>

Versioning and publishing

  • .NET Test (.github/workflows/ci.yml) builds and tests every pull request.
  • Release (.github/workflows/release.yml) runs when a GitHub release is published.

To publish a version:

  1. Merge to main.
  2. Create a GitHub release on a main commit with a new tag vX.Y.Z. For a pre-release, use vX.Y.Z-pre.N and tick Set as a pre-release.
  3. The workflow checks the commit is on main, takes the package version from the tag (without the v: v1.0.0 publishes 1.0.0), builds, tests, packs and attaches the .nupkg to the release. Then:
    • stable releases are pushed to nuget.org through Trusted Publishing (no stored API key);
    • pre-releases are pushed to the Centeva GitHub Packages feed only.

nuget.org usually lists a new version within a few minutes, after validation and indexing.

Trusted Publishing needs a policy on nuget.org for this repository and release.yml, and a NUGET_USER repository secret holding the nuget.org account (user or organization) that owns the policy.

Follow semantic versioning: a change that alters the schema or removes/renames a public type is a new minor (or major) version. The <Version> in the .csproj is only a local default.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
1.0.0 50 11/20/2026