locked
FK PK problem with KnowledgeSyncProvider RRS feed

  • Question

  • Hello,

    I implemented a synchronization utility which synchronizes several tables between a SQL database and a third party application through an COM+ interface.
    Therefore I implemented a KnowlegdeSyncProvider.
    I start synchronization sessions of tables in a specific order to ensure that FK keys of child tables do not cause referential problems.
    When inserting records this works fine.
    However deleting records cause problems.

    For example consider an order -> orderdetail relation.
    I start adding orders because the orderdetail table has a foreign key to the order table.
    When deleting an order this will fail if I start deleting the order.
    Obviously this will cause a foreign key constraint exception.
    Each table has its own session. So it is not possible to synchronize tables in a group.

    When using the ADO.Net sync providers it is possible to use SyncGroups.
    Can I implement that on my custom provider too?

    Regards,

    Jeroen van der Schoot
    Sunday, April 12, 2009 9:32 PM

Answers

  • Yes. This pattern could be implemented within one session.

    If you use Sync Framework Metadata Storage Service APIs to handle sync metadata, it uses a lightweight database to store the metadata in a file which would handle metadata for either single table or multiple tables.
    Ann Tang
    Thursday, April 30, 2009 6:52 PM

All replies

  • Hey,

    Do you mean you could only sync one table for each sync session when you said" Each table has its own session"? if yes, why do you have this limitation?

    Thanks,

    Ann Tang
    Tuesday, April 21, 2009 10:39 PM
  • Hello Ann,

    You can only specify one localand one remoteprovider for the SyncOrchestrator.
    A provider is a specific implementation of a KnowledgeSyncProvider.
    Within a session these two providers are synchronized.
    In a KnowledgeSyncProvider the methods to be implemented all seem to be table oriented.
    Or more to the point per-entity.
    Meta data is also stored on a entity basis in the meta datastore.

    Regards,

    Jeroen
    Wednesday, April 22, 2009 4:13 AM
  • Hey Jeroen,

    I assume  each of your knowledgeSyncProvider only sync one table now. I suggest you enhance your provider to handle multiple tables following the similar change enumeration /change application logic for single table. You could use some Re-Try logic in your provider to handle the FK PK problem.

    Thanks,


    Ann Tang
    Tuesday, April 28, 2009 5:36 PM
  • Hello Ann,

    can I implement that pattern within one session?
    And must I store metadata of several tables in a single metadata store?

    Regards,

    Jeroen
    Wednesday, April 29, 2009 4:17 PM
  • Yes. This pattern could be implemented within one session.

    If you use Sync Framework Metadata Storage Service APIs to handle sync metadata, it uses a lightweight database to store the metadata in a file which would handle metadata for either single table or multiple tables.
    Ann Tang
    Thursday, April 30, 2009 6:52 PM