Skip to content
New issue

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

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

Already on GitHub? # to your account

Speed up ValidateProperty #453

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

Daniel-Svensson
Copy link
Member

Speeds up setting entity properties which does not have any validation attributes on them, by not performing data validation.

  • Check metaMember.IsComplex before casting to ComplexObject for a slight perf increase for all properties
  • Only do validation if property requires validation (don't check whole object)

* Check metaMember.IsComplex before casting to ComplexObject
* Only do validation if property requires validation (don't check whole object)
@Daniel-Svensson
Copy link
Member Author

Related to #450

@Daniel-Svensson Daniel-Svensson merged commit d6fe496 into OpenRIAServices:main Oct 31, 2023
@Daniel-Svensson Daniel-Svensson deleted the perf branch October 31, 2023 08:31
@Daniel-Svensson
Copy link
Member Author

Fyi @SandstromErik the validateproperty method calls validator validateproperty which only checks attributes on the property so it should be safe.
BUT the validateproperty method is virtual so it will be changed behaviour if somebody has overridden it and expects it to always be called if any field requires validation. (Need to remember adding it to changelog as behavior change before new release)

https://github.com/Daniel-Svensson/OpenRiaServices/blob/32494c312056e3aac9b6a3186608a6871341bb3f/src/OpenRiaServices.Client/Framework/Entity.cs#L1339C12-L1339C12

Daniel-Svensson added a commit to Daniel-Svensson/OpenRiaServices that referenced this pull request Nov 1, 2023
Daniel-Svensson added a commit to Daniel-Svensson/OpenRiaServices that referenced this pull request Nov 1, 2023
SandstromErik pushed a commit that referenced this pull request Nov 3, 2023
…property level validation (#455)

* Add tests based on special case for #453

* Add possible fix for regression

* fix CodeQL comment
@Daniel-Svensson Daniel-Svensson added this to the 5.4.1 milestone Nov 13, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant