-
Notifications
You must be signed in to change notification settings - Fork 0
fix: generic constraint test #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b3e309d to
103de10
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR aims to fix generic constraint validation in the Mediator library and add support for .NET 10.0. The main changes include implementing proper generic constraint checking to ensure handlers with unsatisfied constraints are correctly skipped, optimizing handler lookup through caching, and updating target frameworks and package versions to support .NET 10.0.
Key changes:
- Adds
GenericTypeHelperclass with constraint validation logic using CLR'sMakeGenericTypefor reliable constraint checking - Implements caching of matching registrations to avoid repeated enumeration
- Updates all project files to target .NET 10.0 and updates package dependencies
- Adds comprehensive test coverage for various generic constraint scenarios
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
src/Mediator.DependencyInjection/Generic/Handlers/GenericTypeHelper.cs |
New helper class for validating generic constraints and caching registrations |
src/Mediator.DependencyInjection/Generic/Handlers/GenericNotificationHandler.cs |
Adds constraint validation and caching to notification handler lookup |
src/Mediator.DependencyInjection/Generic/Handlers/GenericRequestHandler.cs |
Adds constraint validation and caching to request handler lookup |
src/Mediator.DependencyInjection/Generic/Handlers/GenericStreamRequestHandler.cs |
Adds constraint validation and caching to stream request handler lookup |
src/Mediator.DependencyInjection/Generic/MediatorBuilder.NotificationHandler.cs |
Fixes registration logic to check handler type instead of notification type |
tests/Mediator.DependencyInjection.Tests/Generics/ConstraintValidationTest.cs |
Comprehensive test suite for generic constraint validation across all handler types |
tests/Mediator.DependencyInjection.Tests/Generics/NotificationGenericTest.cs |
Additional tests for generic notification handler registration |
tests/Mediator.DependencyInjection.Tests/Generics/RequestGenericTest.cs |
Test for handler not found exception with generic type mismatch |
Multiple .csproj files |
Updates target frameworks to include net10.0 |
| Multiple package references | Updates package versions for .NET 10.0 compatibility |
| Workflow files | Adds .NET 10.0 SDK to CI/CD pipelines |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.