Next: EOEditingContext class, Previous: EOAdaptorChannel class, Up: Classes [Contents][Index]
EODataSource is an abstract base class, and implements no real functionality on its own, instead you’ll access EODataSource subclass.
A data source represents a collection of rows inside of a table. It can create rows, delete and provide access to the individual rows represented as Enterprise objects.
Typical methods for an EODataSource subclass:
The -fetchObjects method will return an array of enterprise objects. Typically these will be retrieved directly from data in the database server. Then the caller will save the array for access or modification.
The -createObject: method will create a new enterprise object for insertion into the database. A subclass will generally insert this new object into an editing context. Though the caller is responsible for inserting the object into the data source with -insertObject:.
The -insertObject: method will schedule the object for addition into the database server EditingContexts changes are saved to the database.
The -deleteObject: method will schedule the object for removal from the database server when the EOEditingContexts changes are saved to the database.
Subclasses may implement this method to return a detail data source.
A detail data source is a datasource which is created from following a relationship in an object of the receiever: the master object.
in our example you might have a data source for the authors entity and qualify a detail data source, with the toBooks key.
EODatabaseDataSource class is a subclass of EODataSource.
To initialize an EODatabaseDataSource you’ll give it a reference to an EOEditingContext and an entity name.
EODatabaseDataSource initializers:
Once initialized, you can call the EODataSource methods on it, to create fetch insert, and delete objects from the datasource.
Next: EOEditingContext class, Previous: EOAdaptorChannel class, Up: Classes [Contents][Index]