locked
Dependency during Syncronization. RRS feed

  • Question

  • Hi.

    I have two tables .

    CR_SERVICE_REQUEST

    SERVICE_REQUEST_ID_N - PK

    CR_SERVICE_REQUEST_LOG.

    SERVICE_REQUEST_LOG_ID_N- PK

    These two have dependency.Say service request will always have  latest Log id updated.

    There fore during Syncronization,even if the tables are in sync there are scenarios where if the latest log id is updated, it might not be reflected in CR_SERVICE_REQUEST table.

    Please let me know what shall be done in Sync Framework so that to track the changes done and upgrade the latest log id in CR_SERVICE_REQUEST table.

    Also let me know for any details.

    Thanks,

    Sachin K

    Monday, June 20, 2011 9:29 AM

Answers

  • are you're tables self referencing?

    correct me if am wrong, a CR_SERVICE_REQUEST will have multiple child rows in CR_SERVICE_REQUEST_LOG and CR_SERVICE_REQUEST stores the latest REQUEST_CURRENT_LOG_ID_N? is that right?

    if that's the case, isnt youre application supposed to be updating CR_SERVICE_REQUEST for every new entry in CR_SERVICE_REQUEST_LOG? if its doing it then, your CR_SERVICE_REQUEST woudl already contain the latest log entry by the time you sync.

    or are you expecting, Sync Framework to update another table based on an entry from another table? Sync Framework syncs at the table level and dont have any idea about the other tables.

    if you want to update another table (CR_SERVICE_REQUEST), you can subscribe to either ApplyingChanges, ChangesSelected or ChangesApplied event, check if your currently synching CR_SERVICE_REQUEST_LOG and then update CR_SERVICE_REQUEST yourself.

    check out the approach here: http://msdn.microsoft.com/en-us/library/gg294198(v=SQL.110).aspx

    • Marked as answer by sakulkarni83 Friday, July 29, 2011 5:41 AM
    Tuesday, June 21, 2011 1:00 AM

All replies

  • can you post the actual table structure and which provider are you using? how did you provision the tables?

    you mentioned the tables are in sync yet something is not reflected on the other table.

    Monday, June 20, 2011 10:23 AM
  • Actually there are two constraints on these tables.

    CR_SERVICE_REQUEST

    R_42

    SERVICE_REQUEST_ID_N, TOWN_CD_C
    REFERENCES DEV_RUlE.dbo.CR_SERVICE_REQUEST (SERVICE_REQUEST_ID_N, TOWN_CD_C)

    CR_SERVICE_REQUEST_LOG

    R_47

    REQUEST_CURRENT_LOG_ID_N
    REFERENCES DEV_RUlE.dbo.CR_SERVICE_REQUEST_LOG (SERVICE_REQUEST_LOG_ID_N)

    Actually we are getting a constraint error.We debugged we came to know that constraint R 47 has to be removed.

    But the tables have below mentioned interdependency.

    Say for One service request id,there are multiple Log ids.

    The Log Ids are the id s which have multiple status of the request.

    Therefore the references are kept for each table as mentioned above.

    Say if , there is a sceanrio where there is an insertion/deletion of Log ids during Synch, then we need a mechanism,which will update the latest log id in CR_SERVICE_REQUEST.

    Please let me know for further clarifications.

    Regards,

    Sachin K

    Monday, June 20, 2011 10:45 AM
  • are you're tables self referencing?

    correct me if am wrong, a CR_SERVICE_REQUEST will have multiple child rows in CR_SERVICE_REQUEST_LOG and CR_SERVICE_REQUEST stores the latest REQUEST_CURRENT_LOG_ID_N? is that right?

    if that's the case, isnt youre application supposed to be updating CR_SERVICE_REQUEST for every new entry in CR_SERVICE_REQUEST_LOG? if its doing it then, your CR_SERVICE_REQUEST woudl already contain the latest log entry by the time you sync.

    or are you expecting, Sync Framework to update another table based on an entry from another table? Sync Framework syncs at the table level and dont have any idea about the other tables.

    if you want to update another table (CR_SERVICE_REQUEST), you can subscribe to either ApplyingChanges, ChangesSelected or ChangesApplied event, check if your currently synching CR_SERVICE_REQUEST_LOG and then update CR_SERVICE_REQUEST yourself.

    check out the approach here: http://msdn.microsoft.com/en-us/library/gg294198(v=SQL.110).aspx

    • Marked as answer by sakulkarni83 Friday, July 29, 2011 5:41 AM
    Tuesday, June 21, 2011 1:00 AM