Skip to content

Conversation

ajcvickers
Copy link
Collaborator

No description provided.

@ajcvickers ajcvickers requested a review from damieng September 30, 2025 12:05
@ajcvickers ajcvickers requested a review from a team as a code owner September 30, 2025 12:05
@ajcvickers ajcvickers requested review from Copilot and removed request for a team September 30, 2025 12:05
Copy link
Contributor

@Copilot 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

This PR consolidates two expression visitor classes by merging functionality from ProjectionBindingRemovingExpressionVisitor into MongoProjectionBindingRemovingExpressionVisitor and removing the abstract base class.

  • Eliminated abstract base class ProjectionBindingRemovingExpressionVisitor
  • Merged all functionality into the concrete MongoProjectionBindingRemovingExpressionVisitor class
  • Updated inheritance hierarchy to derive directly from ExpressionVisitor

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
ProjectionBindingRemovingExpressionVisitor.cs Removed entire abstract base class file (627 lines deleted)
MongoProjectionBindingRemovingExpressionVisitor.cs Merged functionality from base class, changed inheritance, and added all previously abstract methods

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

var concreteEntityTypeVariable = shaperBlock.Variables.Single(v => v.Type == typeof(IEntityType));
var inverseNavigation = navigation.Inverse;
var fixup = GenerateFixup(
includingClrType, relatedEntityClrType, navigation, inverseNavigation!);
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

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

The null-forgiving operator (!) is used on inverseNavigation without proper null checking. This could lead to runtime exceptions if inverseNavigation is actually null. Consider adding proper null validation or handling the null case explicitly.

Suggested change
includingClrType, relatedEntityClrType, navigation, inverseNavigation!);
includingClrType, relatedEntityClrType, navigation, inverseNavigation);

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@damieng On this, what is the status of unidirectional relationships, where there is one direction but not the inverse? (Technically, relationships with no navigations are also supported, but that's edge.)

Copy link
Member

Choose a reason for hiding this comment

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

We support unidirectional - we have to for owned entities to work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Think I'm going to leave this unchanged for now.

damieng and others added 2 commits September 30, 2025 14:27
…BindingRemovingExpressionVisitor.cs

Co-authored-by: Copilot <[email protected]>
…BindingRemovingExpressionVisitor.cs

Co-authored-by: Copilot <[email protected]>
@ajcvickers ajcvickers merged commit f958c41 into mongodb:main Sep 30, 2025
16 checks passed
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.

2 participants