Async calls to private field properties #1636
Unanswered
JacoJordaan
asked this question in
General
Replies: 1 comment 2 replies
-
Use LazyGetPropertyAsync instead of GetProperty. That will also allow you to get rid of the private backing field completely, which are no longer supported in BOs. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a use case that I am not sure what is the best approach to handle when changing my objects to use async for Blazor wasm compatibility.
Currently I have many using reference properties in my business objects.
The main reasoning is that these are used inside the business object, but must not be serialized as part of the object and also just loaded when demanded.
Also, some of these private field properties are cached - loaded once when required and then loaded from memory.
Many of these properties are used inside business rules, so when a business rule run and there is a condition required for using the property, the business object is loaded into property and used appropriately.
For Blazor wasm I need to change property as follows:
From:
To:
To problem now is that when my business rule is trying to load the property for the first time, it is not yet available and my rule fails.
What is the best approach in these situations?
I was thinking of changing the rule to not run when the property is still null. Add the same rule to the BrandList as primary property and re-run the rule when the BrandList rule changes. I think this may work, but it is not ideal. Any other ideas would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions