Skip to main content
Version: Current

Verified Dapper Quickstart

Use this page when you want a SQL-backed RBAC path without introducing an EF Core DbContext.

What this path proves

  • PrimusSaaS.Rbac.Dapper works with a minimal ASP.NET Core host.
  • SQLite works out of the box.
  • PostgreSQL is supported for live RLS session initialization.
  • The quickstart validates both allow and deny responses plus snapshot and RLS initializer behavior.

Current validation evidence

  • dotnet test sdk/dotnet/tests/PrimusSaaS.Rbac.Tests/PrimusSaaS.Rbac.Tests.csproj --framework net9.0 --filter FullyQualifiedName~RbacInfrastructureCoverageTests /p:CollectCoverage=false --nologo Current run: 16/16 passed.
  • bash examples/RbacDapperQuickstart/verify-live.sh Current run: 6 live SQLite quickstart cases passed.
  • CI workflow: rbac-production-style-validation.yml

Reference host

The reference host is examples/RbacDapperQuickstart.

It shows:

  • schema bootstrap before the Dapper store is resolved
  • IRbacDbConnectionFactory registration
  • a seeded permission, role, and user assignment
  • an optional PostgreSQL RLS session initializer endpoint

Run locally

dotnet run --project examples/RbacDapperQuickstart/RbacDapperQuickstart.csproj --no-launch-profile --urls http://127.0.0.1:5067

Run the verifier

SQLite:

bash examples/RbacDapperQuickstart/verify-all.sh

PostgreSQL:

VERIFY_MODE=postgres bash examples/RbacDapperQuickstart/verify-all.sh

Expected endpoints

  • GET /api/reports/{principalId}
  • POST /api/rbac/check
  • GET /api/rbac/snapshot
  • POST /api/rbac/rls/session

When to choose this path

  • You want direct SQL access and do not want EF Core in the RBAC slice.
  • You already manage schema changes through your own migration pipeline.
  • You need a minimal proof path before moving into the broader Integration Guide.