AureliusDataset.Current<T>

Wagner,


TAureliusDataset provides access to the current record's underlying object through the Current<T> property.  The properties of the object returned, however, do not seem to reflect current dataset field values when the dataset is in edit or insert mode.  Is there a way to force the Current<T> property to provide the same values as in the record buffer or is the FieldByName method the only way?

Unfortunately no, that's bu design and that's the purpose of Dataset.Post. The dataset serves as an intermediate edit buffer before the data is actually "posted" to the object. Otherwise, half of dataset purpose would be defeated, and you could use live bindings or change the object properties directly. The edit buffer is temporary, you could then Post (update the object) or Cancel (leave the object unchanged).


That is unfortunate.  I have designed my classes with a method for validation of current data and various read-only calculated properties.  In order for me to not duplicate this code, I would have to copy the values into a dummy object.  


It would be nice (for me at least) to at least be able to get a read-only object when the data buffer is in insert or edit mode.

How would that work, exactly? Because the dataset "posts" only modified data (i.e., it will only update properties that have been modified). A read-only object that has been newly created might not be exactly the same as the object being edited, because some other properties might be different.

That will require an object cloning, which is also not safe as there are associations involved - should it be deep clone, shallow clone...?