Add support for projectable method overloads#143
Open
PhenX wants to merge 8 commits intokoenbeuk:masterfrom
Open
Add support for projectable method overloads#143PhenX wants to merge 8 commits intokoenbeuk:masterfrom
PhenX wants to merge 8 commits intokoenbeuk:masterfrom
Conversation
Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
Co-authored-by: PhenX <42170+PhenX@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds support for projectable method overloads by including parameter type information in the generated class names. Previously, methods with the same name but different parameter types would cause name collisions in the generated code. The solution encodes parameter types into the generated class name (e.g., _Method_P0_int_P1_string) to make each overload unique.
Changes:
- Modified the source generator to collect parameter type names and include them in generated class names using Roslyn's
SymbolDisplayFormat.FullyQualifiedFormat - Updated the runtime resolver to reconstruct parameter type names from reflection and match them to generated classes
- Added comprehensive tests for method overloads with different parameter types and counts
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/EntityFrameworkCore.Projectables.Generator/ProjectableDescriptor.cs | Added ParameterTypeNames property to store parameter types |
| src/EntityFrameworkCore.Projectables.Generator/ProjectableInterpreter.cs | Collects parameter type names from method symbols using Roslyn |
| src/EntityFrameworkCore.Projectables.Generator/ProjectionExpressionGenerator.cs | Passes parameter type names to class name generator |
| src/EntityFrameworkCore.Projectables/Services/ProjectionExpressionClassNameGenerator.cs | Encodes parameter types into generated class names with sanitization |
| src/EntityFrameworkCore.Projectables/Services/ProjectionExpressionResolver.cs | Reconstructs parameter type names at runtime to find generated classes |
| tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.cs | Added tests for method overloads with different types and counts |
| tests/EntityFrameworkCore.Projectables.FunctionalTests/MethodOverloadsTests.cs | End-to-end tests verifying overload resolution works correctly |
| tests/*/verified.txt files | Updated baseline snapshots to reflect new naming convention with parameter types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/EntityFrameworkCore.Projectables/Services/ProjectionExpressionResolver.cs
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #58