I found a blog post (whose title is included in mine) about this topic which seems to have mounted some interest; including mine. But then, it struck me. The data aware controls available in vcl is a great framework for getting data around easily. Only drawback is, it expects a database as backend, which in many cases is unrealistic or overkill. I would like to use ANY kind of data source, not just databases.
Meet ASProvider. It is the start of a framework to provide the data from any TObject derived class. The provided demo isn't worth much (yet) - but the unit tests should show some of the potential.
Then with a TASProvider.ProvidedObject := TMyObject.Create;
TClientDataSet.Provider := 'ASProvider1'; //or whatever name was used
I will have the public properties of TMyObject as fields in the data set and a single record whose field data will be synchronized with the object. A data set refresh needs to be done to reload if the data in the underlying object is changed, though. Any changes made to the data set that is applied will be propagated to the object.
I've also made a ASCollectionProvider with support for multiple records (the Collection Items).
This is all young code, but I'm really pleased with it so far.