Developer Documentation Library > Data Model > Extending the UNICOM Intelligence Data Model > Creating a CDSC > Implementing the features of a CDSC > Implementing Can Add
 
Implementing Can Add
When the Provider adds new 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 variables to be read.
Calls AddNew on the Command object.
Sets the Value property on the Value objects for the relevant bindings.
Calls Update on the Command object.
Repeats the previous four steps until it has no more records to add.
Calls Close on the Command object (unless the Provider intends to reuse the Command object later).
To cancel the addition of a new record, the Provider would call Delete on the Command object instead of Update, and no data should be written by the CDSC.
For information about the changes required to the Source CreateCommand, DataBindings Append, Delete, and Clear, and Command Close methods, see Implementing Can Select.
You might need to add code to the AddNew method of your Command class, to prepare to receive data through the bound Value objects.
Add code to the Command Update method, to store the data from the bound Value objects in the underlying data source. If your CDSC also supports Can Update, allow for the fact that Update is also used to save changes to an existing record.
Add code to the Command Delete method, to cancel the addition of the new record created by the Command AddNew method. If your CDSC also supports Can Delete, allow for the fact that Delete is also used to delete an existing record.
See also
Handling hierarchical data
CDSC interface
Implementing the features of a CDSC