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
<PackageReference Include="RPS.Dashboard.DataMan" Version="1.0.0" />
<PackageVersion Include="RPS.Dashboard.DataMan" Version="1.0.0" />
<PackageReference Include="RPS.Dashboard.DataMan" />
paket add RPS.Dashboard.DataMan --version 1.0.0
#r "nuget: RPS.Dashboard.DataMan, 1.0.0"
#:package RPS.Dashboard.DataMan@1.0.0
#addin nuget:?package=RPS.Dashboard.DataMan&version=1.0.0
#tool nuget:?package=RPS.Dashboard.DataMan&version=1.0.0
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:
DataManContext.ContextUsername, if set explicitly, e.g.((IUsernameContext)dataMan).SetContextUsername("TaskRunner")for jobs and seeders;- otherwise, if your app registers an
IPrincipalProvider, the current user's identity name (LAN ID), then email, then application ID; - 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()orDatabase.EnsureCreated()onDataManContext; - run
dotnet ef migrations addagainstDataManContext; - register
DataManContextwithCenteva.DatabaseMaintenanceor 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:
This repo: change the entity and/or configuration, build, run the tests, and release a new version.
Dashboard: bump
RPS.Dashboard.DataManinDashboard.Data.csproj, then add the migration in Dashboard, which keeps the migrations inDashboard.DataviaMigrationsAssembly("Dashboard.Data"):cd server dotnet ef migrations add <Name> --project src/Dashboard.Data --startup-project src/Dashboard.Application --context DataManContextApplications 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:
- Merge to
main. - Create a GitHub release on a
maincommit with a new tagvX.Y.Z. For a pre-release, usevX.Y.Z-pre.Nand tick Set as a pre-release. - The workflow checks the commit is on
main, takes the package version from the tag (without thev:v1.0.0publishes1.0.0), builds, tests, packs and attaches the.nupkgto 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 | Versions 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. |
-
net10.0
- Centeva.Auditing (>= 7.0.0)
- Centeva.InterfaceRecord (>= 1.0.0)
- Centeva.PrincipalProvider (>= 2.0.0)
- Microsoft.EntityFrameworkCore.SqlServer (>= 10.0.10)
- System.Security.Cryptography.Pkcs (>= 10.0.13)
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 |