Skip to content

[Feature]: Remove Scrutor Dependency / Offer Manual Registration #217

@eneshoxha

Description

@eneshoxha

Title: Reduce dependency footprint by making Scrutor optional and offering manual handler registration

Labels: enhancement, mediator

Body:

Problem

The core Cortex.Mediator package depends on Scrutor 6.0.1 for assembly scanning. This:

  • Adds a transitive dependency that consumers may not want
  • Prevents use in environments where assembly scanning is undesirable (e.g., Blazor WASM, NativeAOT)
  • Is the only non-Microsoft dependency in the core package

Proposed Solution

Option A (minimal): Add a manual registration API alongside assembly scanning:

services.AddCortexMediator(options =>
{
    options.AddCommandHandler<CreateUserCommand, Guid, CreateUserCommandHandler>();
    options.AddQueryHandler<GetUserQuery, UserDto, GetUserQueryHandler>();
    options.AddNotificationHandler<UserCreatedNotification, SendEmailHandler>();
    // Pipeline behaviors as today
});

Option B (structural): Move Scrutor-based scanning to a separate Cortex.Mediator.Scrutor package:

  • Core Cortex.Mediator has zero non-Microsoft dependencies
  • Cortex.Mediator.Scrutor provides services.AddCortexMediator(markerTypes, ...) with assembly scanning

Both options can coexist and are not mutually exclusive.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestfeatureThis label is in use for minor version increments
No fields configured for Feature.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions