Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Feb 9, 2026

Copilot AI review requested due to automatic review settings February 9, 2026 19:38
@roji roji enabled auto-merge (squash) February 9, 2026 19:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors several EFCore.PG method/member translators to avoid reflection-based MethodInfo lookups, switching to name/declaring-type pattern matching to improve trimming/AOT compatibility (per linked EF Core issue).

Changes:

  • Removed many cached MethodInfo fields and reflection lookups in translators/filters.
  • Replaced MethodInfo equality checks with DeclaringType/Name/argument-shape checks and switch expressions.
  • Converted several translators to primary constructors / field initializers.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/EFCore.PG/Query/Internal/NpgsqlEvaluatableExpressionFilter.cs Replaces MethodInfo equality checks for tsquery/tsvector Parse with name/declaring-type checks.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlTrigramsMethodTranslator.cs Replaces reflection-built dictionaries with method.Name switch-based dispatch.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlStringMethodTranslator.cs Removes many cached MethodInfos and converts translations to method.Name pattern matching/switches.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlRowValueTranslator.cs Replaces comparison MethodInfo map with method.Name switch for EF.Functions row comparisons.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlRangeTranslator.cs Replaces Enumerable.Any() reflection lookup with declaring-type/name/argument pattern checks.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlRandomTranslator.cs Replaces MethodInfo equality check for DbFunctionsExtensions.Random with declaring-type/name check.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlNetworkTranslator.cs Replaces Parse method MethodInfo checks with declaring-type/name/argument checks and refactors mapping selection.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMiscAggregateMethodTranslator.cs Replaces cached MethodInfo checks for string aggregation with declaring-type/name switch.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlMathTranslator.cs Replaces large MethodInfo map with DeclaringType filter + method.Name switch and local helpers.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlLikeTranslator.cs Replaces MethodInfo equality checks with declaring-type/name checks and adds argument-count handling for escape overloads.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlJsonPocoTranslator.cs Replaces reflection-based Enumerable.Any lookup with declaring-type/name/argument pattern checks.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlJsonDomTranslator.cs Replaces cached MemberInfo/MethodInfo checks with member/method name checks for JSON DOM traversal.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlFuzzyStringMatchMethodTranslator.cs Replaces reflection-built map with method.Name switch and declaring-type guard.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlFullTextSearchMethodTranslator.cs Replaces tsquery/tsvector Parse MethodInfo checks with declaring-type/name checks.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlDateTimeMethodTranslator.cs Removes large reflection-based map and replaces parts with name/declaring-type checks/switches.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlConvertTranslator.cs Replaces reflection-built supported methods list with declaring-type/name/type checks.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlBigIntegerMemberTranslator.cs Replaces cached MemberInfo checks with member-name switch guarded by declaring type.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlArrayMethodTranslator.cs Replaces reflection-based method identification (ElementAt/SequenceEqual/etc.) with name/declaring-type/argument patterns.
src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMethodCallTranslatorPlugin.cs Removes many cached MethodInfos; uses name/declaring-type switches for NodaTime method translation.
src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMemberTranslatorPlugin.cs Converts plugin property init; replaces cached members with member-name checks; refactors translator construction.
src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeEvaluatableExpressionFilterPlugin.cs Replaces cached MethodInfo/MemberInfo checks with declaring-type/name checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@roji roji disabled auto-merge February 9, 2026 20:08
Copilot AI review requested due to automatic review settings February 9, 2026 20:29
@roji roji enabled auto-merge (squash) February 9, 2026 20:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@roji roji merged commit 9edb0f1 into npgsql:main Feb 9, 2026
16 checks passed
@roji roji deleted the MethodLookups branch February 9, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant