Hey Frans,
I was wondering if there is a way to cycle through all the dirty (or new) entities in a fetched entity graph.
Here is the whole of the problem we are trying to solve. For every entity in the database, we have two UserID fields, one for the user who created the record, and one for the user who last updated it. These field names and relations are completely uniform.
Right before I recursively save, I would like to call a method that walks the graph and finds every dirty entity. If the entity is new in addition to being dirty, it would set the createdBy field value to the logged in user id. Then it would set the updatedBy field to the same userid.
Is this possible? Is there a better way to apply an update like this uniformly?
We currently have this working, but we test isnew/isdirty after updating all the fields of each entity. This isn't really in a ton of places, but we would prefer to do it in once place to make the operation as uniform and consistent as possible.
As always, thanks for any insight.
Phil