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

Add ObjectHelper support for property resolution for nullable value types #18970

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

namtab00
Copy link
Contributor

@namtab00 namtab00 commented Feb 8, 2024

Description

I'm using an overriding AuditPropertySetter, that sets a long CreatorId (defined on new entity interfaces, not IMust/MayHaveCreator).

With this setup, ObjectHelper.TrySetProperty did not set that property, due to the member selector expression pointing to a value type.

This PR adds retro-compatible support for such an expression, with no breaking changes.

Checklist

  • [ x] I fully tested it as developer / designer and created unit / integration tests
  • I documented it (or no need to document or I will create a separate documentation issue)

How to test it?

Created specific unit test.

@CLAassistant
Copy link

CLAassistant commented Feb 8, 2024

CLA assistant check
All committers have signed the CLA.

@maliming maliming self-requested a review February 8, 2024 01:08
@maliming maliming added this to the 8.2-preview milestone Feb 8, 2024
@namtab00
Copy link
Contributor Author

namtab00 commented Feb 8, 2024

... I'm not sure why the worflow failed, locally all tests pass...

image

Comment on lines +42 to +45
case ExpressionType.Convert: {
memberExpression = propertySelector.Body.As<UnaryExpression>().Operand as MemberExpression;
break;
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you share some test code to cover this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've integrated the test to cover the explicit case.

@namtab00 namtab00 changed the title Add ObjectHelper support for property resolution for value types Add ObjectHelper support for property resolution for nullable value types Feb 8, 2024
Copy link

codecov bot commented Feb 9, 2024

Codecov Report

Attention: 39 lines in your changes are missing coverage. Please review.

Comparison is base (3889c63) 51.68% compared to head (736bb69) 51.68%.
Report is 10 commits behind head on dev.

Files Patch % Lines
...Volo.Abp.Core.Tests/Volo/Abp/ObjectHelper_Tests.cs 0.00% 33 Missing ⚠️
...amework/src/Volo.Abp.Core/Volo/Abp/ObjectHelper.cs 78.57% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #18970      +/-   ##
==========================================
- Coverage   51.68%   51.68%   -0.01%     
==========================================
  Files        3092     3092              
  Lines       98045    98080      +35     
  Branches     7819     7820       +1     
==========================================
+ Hits        50671    50689      +18     
- Misses      45823    45838      +15     
- Partials     1551     1553       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maliming
Copy link
Member

maliming commented Feb 9, 2024

Thanks @namtab00

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.

3 participants