Skip to content

Replace mediatr with cortext.mediator#1111

Closed
Carl Sixsmith (carlsixsmith-moj) wants to merge 2 commits into
developfrom
task/CFODEV-1172-replace-mediat-r
Closed

Replace mediatr with cortext.mediator#1111
Carl Sixsmith (carlsixsmith-moj) wants to merge 2 commits into
developfrom
task/CFODEV-1172-replace-mediat-r

Conversation

@carlsixsmith-moj

Copy link
Copy Markdown
Contributor

🔗 Related Work


📌 Summary

Replaces the MediatR package with Cortex.Mediator.


🎯 Purpose / Motivation

Why does this change exist? What problem are we solving?

MediatR moved away from open source to a paid subscriber model.


🧠 Approach

Queries and Commands are now split for dedicated interfaces

🧪 How to Test

Step-by-step instructions to verify this works.

Requires a full system regression test.

⚠️ Risks & Impact

  • Breaking change
  • Database change
  • Performance impact
  • Security impact

Details:

Anything reviewers should be cautious about.

This is a massive change and should not be merged until we are fully confident all issues are ironed out.

🙋 Notes for Reviewers

This pull request migrates the application from using MediatR to Cortex.Mediator as the in-process messaging library, updating dependencies, interfaces, and documentation accordingly. It also removes MediatR-specific exception handlers and introduces new compatibility and mediator infrastructure to support Cortex.Mediator. The changes affect package references, architectural documentation, key interfaces, and the dependency injection setup.

Migration from MediatR to Cortex.Mediator:

  • Replaces the MediatR NuGet package with Cortex.Mediator in the solution's dependencies and removes MediatR from Renovate configuration. (Directory.Packages.props [1] src/Application/Application.csproj [2] renovate.json [3]
  • Updates Clean Architecture documentation and code samples to reference Cortex.Mediator and its types (ICommand<T>, IQuery<T>, etc.) instead of MediatR (IRequest<T>). (.github/copilot-instructions.md [1] [2] [3] [4]
  • Changes the pipeline behaviors and validation constants to use Cortex.Mediator terminology. (.github/copilot-instructions.md [1] src/Application/Common/Validators/ValidationConstants.cs [2]

Codebase and Interface Refactoring:

Mediator Infrastructure and Compatibility:

  • Adds SequentialNotificationMediator to ensure notifications are handled sequentially and integrates it as the application's mediator implementation. (src/Application/Common/Mediator/SequentialNotificationMediator.cs [1] src/Application/DependencyInjection.cs [2] [3]
  • Introduces MediatorCompatibilityExtensions to provide MediatR-like extension methods for Cortex.Mediator, aiding migration and compatibility. (src/Application/Common/Extensions/MediatorCompatibilityExtensions.cs src/Application/Common/Extensions/MediatorCompatibilityExtensions.csR1-R38)

Dependency Injection and Pipeline Behaviors:

Cleanup of MediatR-specific Exception Handlers:

  • Removes MediatR-specific exception handler classes (DbExceptionHandler, ServerExceptionHandler, ValidationExceptionHandler). (src/Application/Common/Exceptions/DbExceptionHandler.cs [1] src/Application/Common/Exceptions/ServerExceptionHandler.cs [2] src/Application/Common/Exceptions/ValidationExceptionHandler.cs [3]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@carlsixsmith-moj

Copy link
Copy Markdown
Contributor Author

Tested:

  • Searches
  • Document Exports
  • Payments
  • QA

@carlsixsmith-moj Carl Sixsmith (carlsixsmith-moj) force-pushed the task/CFODEV-1172-replace-mediat-r branch from 5e5b55e to 149c8a9 Compare May 30, 2026 14:39
@carlsixsmith-moj Carl Sixsmith (carlsixsmith-moj) added Needs Review This pull request is awaiting review Feature This is a new feature (or extending an existing one) Large Change This pull request is a large change labels Jun 1, 2026
@carlsixsmith-moj Carl Sixsmith (carlsixsmith-moj) force-pushed the task/CFODEV-1172-replace-mediat-r branch 2 times, most recently from abbe083 to dcf1524 Compare June 3, 2026 16:45
@carlsixsmith-moj Carl Sixsmith (carlsixsmith-moj) force-pushed the task/CFODEV-1172-replace-mediat-r branch 2 times, most recently from baf4c4c to 5e5b0b4 Compare June 11, 2026 06:50
@carlsixsmith-moj Carl Sixsmith (carlsixsmith-moj) force-pushed the task/CFODEV-1172-replace-mediat-r branch from 5e5b0b4 to d2f5558 Compare June 14, 2026 10:46
@samgibsonmoj Sam Gibson (samgibsonmoj) force-pushed the task/CFODEV-1172-replace-mediat-r branch from 15d1fd7 to 04c0b3c Compare June 18, 2026 08:59
@carlsixsmith-moj Carl Sixsmith (carlsixsmith-moj) force-pushed the task/CFODEV-1172-replace-mediat-r branch from 04c0b3c to 15d1fd7 Compare June 18, 2026 09:15
@carlsixsmith-moj Carl Sixsmith (carlsixsmith-moj) deleted the task/CFODEV-1172-replace-mediat-r branch June 18, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature This is a new feature (or extending an existing one) Large Change This pull request is a large change Needs Review This pull request is awaiting review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants