Filter types by CustomHandler generic constraints#48
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for filtering types based on generic constraints defined on CustomHandler methods. When a CustomHandler method is generic, types are now automatically validated against the constraints (such as class, struct, new(), and interface constraints) before being passed to the handler.
Key changes:
- Version bumped from 2.3 to 2.4
- Added constraint validation logic in the source generator
- Added comprehensive test coverage for various constraint scenarios
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| version.json | Bumped version from 2.3 to 2.4 |
| ServiceScan.SourceGenerator/DependencyInjectionGenerator.FilterTypes.cs | Implemented generic constraint validation logic with support for reference/value type constraints, constructor constraints, and nested type parameter constraints |
| ServiceScan.SourceGenerator.Tests/CustomHandlerTests.cs | Added six test cases covering different constraint scenarios (new(), class, nested type parameters, multiple interfaces, struct, and combined constraints) |
| README.md | Updated documentation to clarify that CustomHandler methods with generic constraints automatically filter types |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Fixes #46 .