Executing custom business logic RRS feed

  • Question

  • Hello,

    Here is the issue I am facing with executing custom business logic with sync services for ADO.NET v 1.0:

    I have a timesheet table in SQL compact database on windows mobile device. I am synchronizing this table using sync services. However in some cases I am actually using a custom web service to do inserts on server instead of utilising sync services. In that case, I am getting all deltas in the clientSyncProvider_ChangesSelected event and checking if they are inserts, then I delete them from the delta table using the following code:

     private static void clientSyncProvider_ChangesSelected(object syncAgent, ChangesSelectedEventArgs args)
                                 DataTable tblTimesheet = args.Context.DataSet.Tables[ConfigurationSettings.TableOwner + "tbl_timesheets"];
       for (int tsCount = 0; tsCount < tblTimesheet.Rows.Count; tsCount++)
                            if (tblTimesheet.Rows[tsCount].RowState == DataRowState.Added)
    //step 1:
    delete the row from the delta table

    //step 2:
    Let custom web service do inserts on server

    //step 3:
    delete the timesheet record from the sql compact data on device





    This goes fine. However I believe as soon as I delete the record from the actual compact database in step 3, the record again goes in the delta table with the rowstate as deleted. I want to delete that row from the delta table also so that the delta table just doesnt keep storing these redundant records. But my problem is that I dont get access to that row unless I fire this change_selected event again. Is that correct?

    If so then it is okay if user doesnt shut the application down and synchronizes again because I store the primary key of the record deleted in step 3 and I can delete that from the delta table. But what happens if user shuts the application and restarts and synchronizes again, in that case, I am not able to delete that particular row because I do not know its primary key.

    Is there a way to accomplish this task. Appreciate anyone's suggestion.


    • Moved by Tina_Tian Friday, April 22, 2011 7:52 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Thursday, November 13, 2008 10:22 PM

All replies

  • Why do you want to throw away the rows from the client?

    Can you instead modify the client code so to never have inserted them?



    Tuesday, November 18, 2008 11:07 PM