For more information about the CustDB sample database, see Setting up the CustDB consolidated database.
CustdbScripts.dll, created in the previous lesson, encapsulates the methods UploadInsert() and DownloadCursor(). These methods contain implementation for the ULCustomer upload_insert and download_cursor events, respectively.
In this section, you specify class methods for table-level events using two approaches:
Using the MobiLink Synchronization plug-in.
You connect to the CustDB database with Sybase Central, change the language for the upload_insert script to .NET, and specify MLExample.CustdbScripts.UploadInsert to handle the event.
Using the ml_add_dnet_table_script stored procedure.
You connect to the CustDB database with Interactive SQL and execute ml_add_dnet_table_script, specifying MLExample.CustdbScripts.DownloadCursor for the download_cursor event.
Connect to the sample database using the MobiLink Synchronization plug-in:
Start Sybase Central.
In the View menu, ensure that Folders is selected.
From the Connections menu, select Connect With MobiLink 11.
On the Identification tab, choose the ODBC Data Source Name SQL Anywhere 11 CustDB.
Click OK to Connect.
Sybase Central should now display the CustDB data source under the MobiLink 11 plug-in.
Change the language for the ULCustomer table upload_insert event to .NET:
In the left pane, open the Synchronized Tables folder and select the ULCustomer table. A list of table-level scripts appears in the right pane.
In the right pane, open the custdb 11.0 upload_insert table script. From the File menu, choose Language, and change the language to .NET.
Enter the .NET method name for the custdb 11.0 upload_insert table script.
Delete the contents of the upload_insert table script so that the right pane appears blank.
Type the following in the right pane:
MLExample.CustdbScripts.UploadInsert |
From the File menu, choose Save to save the script.
Exit Sybase Central.
This step uses Sybase Central to specify a .NET method as the script for the ULCustomer upload_insert event.
Alternatively, you can use the ml_add_dnet_connection_script and ml_add_dnet_table_script stored procedures. Using these stored procedures is more efficient, especially if you have a large number of .NET methods to handle synchronization events.
See ml_add_dnet_connection_script system procedure and ml_add_dnet_table_script system procedure.
In the next section you connect to CustDB with Interactive SQL and execute ml_add_dnet_table_script, assigning MLExample.CustdbScripts.DownloadCursor to the download_cursor event.
Connect to the sample database with Interactive SQL.
Choose Start » Programs » SQL Anywhere 11 » Interactive SQL, or run the following command:
dbisql |
Click the Identification tab.
Click ODBC Data Source Name and type SQL Anywhere 11 CustDB.
Click OK to connect.
Execute the following command in Interactive SQL:
CALL ml_add_dnet_table_script( 'custdb 11.0', 'ULCustomer', 'download_cursor', 'MLExample.CustdbScripts.DownloadCursor'); COMMIT; |
The following is a description of each parameter:
Parameter | Description |
---|---|
custdb 11.0 | The script version. |
ULCustomer | The synchronized table. |
download_cursor | The event name. |
MLExample.CustdbScripts.DownloadCursor | The fully qualified .NET method. |
Exit Interactive SQL.
In this lesson, you specified .NET methods to handle ULCustomer table-level events. The next lesson ensures that the MobiLink server loads the appropriate class files and the MobiLink server API.
For more information about adding and deleting synchronization scripts, see Adding and deleting scripts.
For more information about the scripts used in this lesson, see ml_add_dnet_connection_script system procedure and ml_add_dnet_table_script system procedure.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |