Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert entity property to entry property type. #4920

Merged
merged 5 commits into from
Aug 10, 2020

Conversation

maliming
Copy link
Member

Fix #4917

@maliming maliming requested a review from hikalkan July 30, 2020 07:08
@maliming maliming added this to the 3.1 milestone Jul 30, 2020
var entityProperty = entity.GetProperty(property.Name);
if (entityProperty == null)
{
continue;
Copy link
Member

@hikalkan hikalkan Aug 8, 2020

Choose a reason for hiding this comment

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

But we also want to set null if entity.GetProperty(property.Name) returns null. Because we already checked entity.HasProperty(property.Name) before. So, if entity.GetProperty(property.Name) returns null that means it is intentionally set to null. It doesn't mean the property is missing. So, skipping if entityProperty == null makes a breaking change and breaks the current behavour. This would be better:

if (entityProperty == null)
                {
entry.Property(property.Name).CurrentValue = null;
                    continue;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I updated the code and unit test.

@maliming maliming requested a review from hikalkan August 10, 2020 05:44
@hikalkan hikalkan merged commit 1fc4d03 into dev Aug 10, 2020
@hikalkan hikalkan deleted the maliming/HandleExtraPropertiesOnSave branch August 10, 2020 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ObjectExtension: Handle extra property's type when deserialzing json with integer property value
2 participants