Skip to content

Issue 3422 ExplicitExpansion#3473

Merged
jbogard merged 1 commit intomasterfrom
Issue3422ExplicitExpansion
Sep 16, 2020
Merged

Issue 3422 ExplicitExpansion#3473
jbogard merged 1 commit intomasterfrom
Issue3422ExplicitExpansion

Conversation

@BlaiseD
Copy link
Copy Markdown
Contributor

@BlaiseD BlaiseD commented Jul 22, 2020

Fix for Issue #3422

@BlaiseD BlaiseD requested a review from lbargaoanu July 22, 2020 15:02
@lbargaoanu
Copy link
Copy Markdown
Contributor

Breaking change. And also ad-hoc I'd say. Why would the parent of the last member in the path would be so special? Taking into account the whole path, that would make a lot more sense to me. That would be a breaking change too :) But the whole idea seems kind of subtle and prone to misunderstandings. Not really about the code...

@lbargaoanu
Copy link
Copy Markdown
Contributor

lbargaoanu commented Jul 22, 2020

I presume Include in EF (kind of similar) works by considering the whole structural path.

@BlaiseD
Copy link
Copy Markdown
Contributor Author

BlaiseD commented Jul 22, 2020

Where are you seeing "last member in the path"? Both of the following set the parent for every item - unless I'm missing something.

                node.GetMemberExpressions()
                    .Select(e => new MapMemberInfo(e.Member, e.Expression.Type))
                foreach (var memberName in fullMemberName.Split('.'))
                {
                    var currentType = GetCurrentType(property, type);
                    property = currentType.GetFieldOrProperty(memberName);
                    yield return new MapMemberInfo(property, currentType);
                }

What would be your approach? (requested opinions earlier)

@BlaiseD
Copy link
Copy Markdown
Contributor Author

BlaiseD commented Jul 22, 2020

A breaking change would break existing tests - right? Or define breaking change.

@lbargaoanu
Copy link
Copy Markdown
Contributor

You interpret the same parameters in a different way. Clearly some code will break. I guess the problem is that the member list is flattened, as opposed to a structural path.

@BlaiseD
Copy link
Copy Markdown
Contributor Author

BlaiseD commented Jul 22, 2020

Seems to me like it's working as before with exception of the "member belongs to a base class" scenario - which is the fix.

I don't see MemberInfo.ReflectedType being used anywhere else in the code.

The inheritance design is because we collect the member infos before the call to ExpressionBuilder.GetMapExpression - I think changing that interface would have been a bigger break.

It's ok to come up with a new design once you've had time to think about it - this can stay on hold. We know the underlying problem.

@lbargaoanu lbargaoanu changed the title Fix for Issue #3422 (Odd behavior in Explicit Expand with inherited models) Fix for Issue #3422 Jul 23, 2020
@jbogard jbogard added this to the v.next milestone Sep 16, 2020
@jbogard jbogard merged commit 97b9649 into master Sep 16, 2020
@lbargaoanu lbargaoanu deleted the Issue3422ExplicitExpansion branch September 16, 2020 18:50
@lbargaoanu lbargaoanu changed the title Fix for Issue #3422 Issue 3422 ExplicitExpansion Sep 18, 2020
@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2020
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;

return this._memberInfo.Equals(other);
Copy link
Copy Markdown
Contributor

@lbargaoanu lbargaoanu Jun 25, 2021

Choose a reason for hiding this comment

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

Always false when comparing two MapMemberInfos. My co-workers traced a memory leak back to this line. The projection cache keeps growing in 10.1.1. No longer the case now, so it's fixed in 11.0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep - here's from PropertyInfo source:
image

MemberInfo does the same. Thanks for the heads-up.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants