Friday, June 24, 2005

[Opf3] What uses the ObjectReader to get the data?

The ObjectReader has to get an object that implements the IDataReader interface to retrieve the data from the storage. The constructor (which is internal right now - to avoid people to create ObjectReader from nowhere) takes an instance of a class that implements the IDataReader interface.

Internally the ObjectReader loops over the items in the IDataReader and queries the fields to populate the objects. To say the truth it isn't even the ObjectReader who populates the persistent objects. The ObjectReader navigates only to the row. The current row is then given to the ObjectDataAdapter (an internal class found in the Chili.Opf3.Storages namespace) which checks the fields in the row and populates the persistent object with data.

The ObjectDataAdapter is actually an interesting class for people who want to understand how the mapping between storage and persistent objects is working. The class has different methods to get data from the storage and to create a query expression that is used to insert, update or delete an object in/from the storage.


Post a Comment

<< Home