omar wrote:
Greetings,
I always thought of an entity's IsDitry as a flag for when any of the entity's fields is changed. The problem is when an entity is loaded from the database (like when loading a collection from the database); in that case also the entity's IsDirty is True.
No, when an entity is loaded from the db, IsDirty is false. This is because the object fetch routine uses ForcedCurrentValueWrite to set the field values, no flags are set.
If you set fields yourself in the InitClass.. method, the fields get dirty. if you don't want that, set the field values using fields(index).ForcedCurrentValueWrite(..)
When does your entity's IsDirty flag become set to true then after a fetch?
What I really need is a flag for when the entity's fields become dirty by assignment (from code or UI) and not by loading from the DB.
That's the task of the IsDirty
In other wards, IsDirtyEx
* entity is NOT fetched: return the value of the normal IsDirty flag
* entity is FETCHED; when an entity's field value changes from that of its DB value, return True otherwise its False
So when the entity is new and you've set a couple of fields, IsDirtyEx should not return true? That's odd I think. IsDirty signals if fields have been changed.
For which scenario do you need this?