Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,22 @@ public virtual Expression CreatePropertyValueExpression(QueryBinderContext conte
PropertyInfo propertyInfo = source.Type.GetProperty(propertyName, BindingFlags.DeclaredOnly);
if (propertyInfo == null)
{
propertyInfo = source.Type.GetProperty(propertyName);
/*
History of code:
propertyInfo = source.Type.GetProperty(propertyName);
This code fixes an issue where 'History of code' was unable to obtain attributes with the same name as the parent class after the subclass hid the parent class member.
Such as:
'History of code' cannot get the Key property of the Child.
public class Father
{
public string Key { get; set; }
}
public class Child : Father
{
public new Guid Key { get; set; }
}
*/
propertyInfo = source.Type.GetProperties().Where(m => m.Name.Equals(propertyName)).FirstOrDefault();
Comment thread
Dean-ZhenYao-Wang marked this conversation as resolved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would you please add some comments for your change in the source file?

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.

Would you please add some comments for your change in the source file?

Code comments have been added to the new submission

}

Expression propertyValue = Expression.Property(source, propertyInfo);
Expand Down