Data Model > Extending the UNICOM Intelligence Data Model > Creating a CDSC > Implementing the features of a CDSC > Implementing Can Delete
 
Implementing Can Delete
When the Provider deletes existing data records through the CDSC, it:
Calls CreateCommand on the Source object to get a Command object (unless it is reusing an existing Command object).
Adds bindings to the Command object for the relevant variables.
Calls MoveNext (MoveFirst, the first time) on the Command.
If the current record is the one the Provider wants to delete, it calls Delete on the Command.
Repeats the previous two steps until the Command object's EOF property is true, or there are no more records that it wants to delete.
Calls Close on the Command object (unless the Provider intends to reuse the Command object later).
If backward scrolling is supported and the Provider wants to access the data in reverse order, it uses MoveLast, MovePrevious, and BOF instead of MoveFirst, MoveNext, and EOF. For more information, see Implementing Scroll Backward.
To determine whether the current record is the one it wants to delete, the Provider may retrieve the Value property from the Value objects involved in a selection expression (such as a Where clause). These Value objects are bound to the Command.
For information about the changes required for the Source CreateCommand, DataBindings Append, Delete, and Clear, and Command Close methods, see Implementing Can Select.
Add code to the Command Delete method, to remove the current record from the underlying data source. If your CDSC also supports Can Add, allow for the fact that Delete is also used to cancel the addition of the new record created by the Command AddNew method.
See also
Handling hierarchical data
CDSC interface
Implementing the features of a CDSC