Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » MobiLink - 入门 » MobiLink 教程 » 教程:使用 .NET 同步逻辑

 

第 3 课:为 upload_insert 事件预订脚本

本课假定您已完成前面的所有课程。 请参见第 1 课:利用 MobiLink 参考编译 CustdbScripts.dll 程序集

在本课中,您将使用 Sybase Central 将 .NET 方法指定为 ULCustomer upload_insert 事件的脚本。使用 Sybase Central 连接到 CustDB 数据库,将 upload_insert SQL 脚本替换为 .NET 脚本,然后指定 MLExample.CustdbScripts.UploadInsert 来处理事件。

也可以使用 ml_add_dnet_connection_script 和 ml_add_dnet_table_script 存储过程。使用这些存储过程效率更高,特别是在使用大量 .NET 方法处理同步事件时。

 ♦ 为 ULCustomer 表的 upload_insert 事件预订 CustdbScripts.uploadInsert
  1. 在 Sybase Central 中,单击 [视图] » [文件夹]。

  2. 在 Sybase Central 左窗格的 [MobiLink 12] 下,依次展开 [mldotnet_project]、[统一数据库]、[mldotnet_db]、[同步表] 和 [ULCustomer]。

  3. 在右窗格中,选择 custdb 12.0 upload_insert 表脚本。单击 [编辑] » [删除]。

  4. 创建新的 upload_insert 表脚本。

    1. 单击 [文件] » [新建] » [表脚本]。

    2. 在 [您要为哪个版本创建表脚本] 列表中,单击 custdb 12.0

    3. 在 [哪个事件应导致执行表脚本] 列表中,单击 [upload_insert],然后单击 [下一步]。

    4. 选择 [创建新脚本定义],然后选择 [.NET]。

    5. 单击 [完成]。

  5. 输入 custdb 12.0 upload_insert 表脚本要装载的 .NET 方法名称。

    在 Sybase Central 的右窗格中,为 upload_insert 事件添加以下 .NET 脚本:

    MLExample.CustdbScripts.UploadInsert
  6. 单击 [文件] » [保存] 保存脚本。

  7. 关闭 Sybase Central。

  8. 前进至第 4 课:为事件指定类方法