Skip to content
CAI
Software that uses CAICheck a score

madslundt/NetCoreMediatrSample

52.0

Adequate · 21 September 2026

2k

lines of production code

C#

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add Docker Compose configuration and update documentation for local development

Users can now start the entire application stack—including the API, background worker, and SQL Server database—using a new docker-compose.yaml file. The README has been updated with instructions to run the services via docker-compose up, and the project structure documentation now includes the new BackgroundWorker and test projects.

(repo-wide) · high confidence

Added health check endpoints and notification service interfaces

The application now exposes a /health endpoint for monitoring system status via new HealthChecksExtensions. Additionally, a NotificationService has been introduced with interfaces for sending emails and push notifications, providing the foundation for future notification capabilities.

Infrastructure/HealthChecks, NotificationService · high confidence

BackgroundWorker now supports Hangfire for background job management

The BackgroundWorker has been updated to integrate Hangfire, enabling background job processing and dashboard access at the /hangfire endpoint. This change includes new Dockerfile and .dockerignore configurations to support containerized deployment, along with updated Program.cs and appsettings.json to configure Hangfire and database connections.

BackgroundWorker · high confidence

Introduce Hangfire-based background job processing

The application now supports background job execution via Hangfire. A new \IBackgroundJobBus\ interface and \HangfireJobBus\ implementation allow enqueuing, scheduling, and managing recurring jobs. The Hangfire dashboard is exposed at a configurable path, and the infrastructure registers the necessary services and storage providers.

Infrastructure/BackgroundJob · high confidence

Behavioural changes

API introduces background job processing and health checks

The API now supports background job processing via Hangfire, requiring a new 'BackgroundJobConnectionString' in the configuration. Additionally, the API exposes health check endpoints and implements global exception handling middleware. The user-facing API contract changes slightly: the 'UpdateUserTaskBodyDto' now expects a strongly typed 'UserId' instead of a raw string for the 'AssignToUserId' field.

Api · high confidence

Added user task assignment notifications and refactored user lifecycle logging

Users will now receive an email notification when a new user task is assigned to them, implemented via the new NotifyAssignedUserEventHandler. Additionally, the system has been updated to log user creation and deletion events, with the corresponding event handlers renamed to LogUserCreatedEventHandler and LogUserDeletedEventHandler to better reflect their purpose.

EventHandlers · high confidence

Enforce strongly-typed UserId across user commands and queries

The user management components now use a strongly-typed \UserId\ struct instead of raw strings for identifiers. In \CreateUser\, the command now accepts an \Email\ field and validates it as a valid email address, while the result object returns the new \UserId\ type. In \GetUser\, the query parameter and validation logic have been updated to work directly with \UserId\, removing the need for manual string-to-ID conversion. In \DeleteUser\, the \NotFoundException\ now receives the \UserId\ directly. These changes improve type safety and reduce boilerplate by eliminating manual parsing of user IDs.

Components/UserComponents · high confidence

Initial database schema and configuration for UserTasks and Users

The DataModel now includes the initial migration (20230905193848\_Init) which creates the UserTasks, Users, TaskStatusRef, and UserStatusRef tables, along with their relationships and indexes. The database context has been updated to expose UserTasks as a DbSet, and strongly typed ID conversions have been added. Additionally, the database connection configuration has been changed from an in-memory provider to SQL Server, and the design-time context factory now loads connection strings from appsettings.json files.

DataModel · high confidence

Refactor base model classes to use generic strongly typed IDs

The base model classes have been updated to support generic strongly typed IDs. Specifically, the base model now uses a generic constraint where the ID type must inherit from StronglyTypedIdBaseEntity\<TId\>, and the ID property is initialized via a static New() method rather than reflection. Additionally, the base model enum class now initializes its properties with default values and adjusts constructor visibility.

DataModel/Models · medium confidence

Refactor code formatting and remove unused import

The codebase has been refactored to improve formatting consistency. Specifically, the \Microsoft.Extensions.Configuration\ import was removed from \ComponentsExtensions.cs\ as it was unused. Additionally, the \TaskStatusEnum\ and \UserStatusRefContext\ classes were reformatted to use a more compact, single-line style for the \Build\ method bodies, and the \TaskStatusEnum\ was updated to remove the trailing comma before the closing brace.

Components, DataModel/Models/Refs · medium confidence

Refactor exception handling infrastructure

The exception handling middleware and its associated extension methods have been refactored to improve code structure and readability. The \ExceptionHandlingMiddleware\ class now uses explicit block syntax for constructors and switch expressions, and the \NotFoundException\ class has been updated to accept a \StronglyTypedIdBaseEntity\ for its ID parameter, while moving the \PropertyIdMessage\ helper method to a private static method. These changes standardize the error handling pipeline in the \Infrastructure/ExceptionHandling\ layer.

Infrastructure/ExceptionHandling · medium confidence

Refactor strongly typed ID infrastructure with generic base and new converters

The strongly typed ID infrastructure has been refactored to use a generic base class (StronglyTypedIdBaseEntity\<T\>) and a static New() method for instantiation. New conversion support has been added for Entity Framework Core (StronglyTypedIdConversions.cs), System.Text.Json serialization (StronglyTypedIdJsonConverterFactory.cs), and .NET TypeConverter (StronglyTypedIdConverter.cs). Validation extensions have also been updated to support both string and strongly typed ID parameters.

Infrastructure/StronglyTypedIds · medium confidence

Refactor strongly typed ID to use a generic base class

The UserTask model's ID type has been refactored to use a generic base class, reducing boilerplate and improving type safety. Additionally, the UserTaskContext has been updated to reflect these changes, ensuring consistent configuration for the UserTask entity.

DataModel/Models/UserTasks · medium confidence

Refactor user and user-task controllers to use strongly-typed IDs and split attributes

The User and UserTask controllers now use strongly-typed ID models (UserId, UserTaskId) instead of raw strings for route parameters, and split combined HTTP method and route attributes into separate \[HttpGet\]/\[HttpPost\]/\[HttpDelete\]/\[HttpPatch\] and \[Route\] attributes. In the UserTask controller, the success response path for creating a task was also corrected to return /api/user-tasks/... instead of /api/tasks/....

Api/Controllers · medium confidence

Refactor user task commands to use strongly-typed ID types

The command handlers for creating, updating, and deleting user tasks have been updated to use strongly-typed ID types (UserId, UserTaskId) instead of raw strings. This change improves type safety and reduces boilerplate by removing manual ID construction and string parsing. Additionally, the Create command now enforces non-empty title and description fields, and the delete/update handlers now reference the UserTasks collection directly.

Components/UserTaskComponents/Commands · high confidence

Refactor user task queries to use strongly typed IDs

The \GetUserTask\ query now accepts a strongly typed \UserTaskId\ instead of a raw string, and the result model uses \UserId\ types for \CreatedByUserId\ and \AssignedToUserId\ instead of strings. Additionally, the query handler for retrieving tasks created by a user (\GetUserTasksCreatedByUser\) was added to support listing tasks by creator.

Components/UserTaskComponents/Queries · high confidence

Removal of StronglyTypedId EF Core extension

The extension method \SupportStronglyTypedId\ for configuring Entity Framework Core property builders has been removed. This means the automatic conversion of strongly typed ID values to their underlying primitive types is no longer applied via this specific helper, requiring developers to configure these mappings manually or use alternative approaches.

DataModel/Libs/Extensions · high confidence

Simplified CQRS infrastructure by removing background job bus abstraction

The CQRS infrastructure has been refactored to remove the custom \BackgroundJobBus\ abstraction and its associated interfaces (\IBackgroundJob\, \IBackgroundJobBus\, \IBackgroundJobHandler\). The \EventBus\ now directly depends on and uses the background job bus for event publishing, simplifying the event handling flow. Additionally, the \CQRSExtensions\ registration has been cleaned up by removing the registration of the deleted background job bus and the exception handling middleware, while other CQRS components like \CommandBus\, \QueryBus\, and \EventBus\ remain registered.

Infrastructure/CQRS · high confidence

Swagger UI now enforces OAuth2 security on API endpoints

The Swagger/OpenAPI documentation now automatically applies OAuth2 security requirements to all API endpoints that are not marked as public. This is achieved by introducing an \AuthOperationsFilter\ that adds security schemes to operations, and a \StronglyTypedIdSchemaFilter\ to correctly format strongly typed ID properties in the generated schema. Users will see security requirements reflected in the Swagger UI, ensuring that the documentation accurately represents the authentication needs of the API.

Infrastructure/Swagger · high confidence

User model updates: email field and default status

The User model now includes an Email property and initializes the StatusEnum to Active by default. Additionally, navigation properties for user tasks are initialized to null to prevent null-reference issues.

DataModel/Models/Users · medium confidence

Test coverage

Added integration tests for the User API; Added unit tests for the GetUser component; Added unit tests for the NotifyAssignedUserEventHandler.

Dependencies

Add .csproj files for new test projects and background worker

The diff introduces new project files for unit and integration tests (Api.IntegrationTests, Components.UnitTests, EventHandlers.UnitTests) and a new BackgroundWorker service, all targeting .NET 7.0. These files define dependencies on testing frameworks like xUnit, FluentAssertions, and Testcontainers, as well as project references to the main application components.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 74 → 52 (-21.8)
  • Rubric changed (rubric-2026.08.18 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 81 → 80 (-0.7)
  • Architecture 84 → 84 (+0.0)
  • Maturity 69 → 53 (-16.0)
  • Readiness 71 → 38 (-33.7)
  • Security 86 → 65 (-20.8)
  • Event-Driven 100 → 100 (+0.0)

Resolved (7)

  • Bounded contexts not declared
  • Medium CVE: Azure.Identity 1.6.0
  • Medium CVE: Azure.Identity 1.6.0
  • No exposed public API
  • XML-doc coverage: BackgroundWorker (BackgroundWorker/BackgroundWorker.csproj)
  • early-stage repository — too little history to judge knowledge freshness
  • single-maintainer — knowledge-concentration (bus factor) risk

New (13)

  • Documentation: no architecture or design documentation (README.md)
  • Duplicated block (9 lines × 2) (Components/UserTaskComponents/Commands/DeleteUserTask.cs)
  • End-of-life runtime: .NET net7.0
  • High CVE: SSH.NET 2020.0.2
  • High IaC: WD-COMPOSE-0002 (docker-compose.yaml)
  • Medium IaC: WD-DOCKER-0003 (Api/Dockerfile)
  • Medium IaC: WD-DOCKER-0003 (Api/Dockerfile)
  • Medium IaC: WD-DOCKER-0003 (BackgroundWorker/Dockerfile)
  • Medium IaC: WD-DOCKER-0003 (BackgroundWorker/Dockerfile)
  • No ADRs found
  • No test project references BackgroundWorker (BackgroundWorker/BackgroundWorker.csproj)
  • WriteOnlyPrivateField (Infrastructure/StronglyTypedIds/StronglyTypedIdConverter.cs)
  • redundant comment (Infrastructure/Swagger/SwaggerExtensions.cs)

API surface

  • Unchanged — 7 HTTP endpoints

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

madslundt/NetCoreMediatrSample was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit e752c85c675822668386a59fa5cc7f763530106c — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-28e75b8e3254.