locked
Store local IDs in metadata RRS feed

  • Question

  • Hi,

     

    I'm creating custom providers to sync 2 different databases, with different IDs formats for related tables (ex. Customer table in DB1 ID is String and Customer table in DB2 ID is Number).

     

    Ex. providers: BD1CustomerProvider and BD2CustomerProvider, BD1OrderProvider and BD2OrderProvider, etc.

     

    I don't want to change the DB formats to support sync, so I'm using the SqlMetadataStore in my providers to store a global ID (GUID) that identifies an item for both DBs, but I also need to store the local ID in this metadata so that I can relate it to the specific DB item.

     

    Were should I store this local ID? Is there any standard support for this local ID in SqlMetadataStore?

    1. When I create the ReplicaMetadata through the MetadataStore I pass a SyncIdFormatGroup where I define the ReplicaIdFormat and ItemIdFormat. Can I use one of these IDs to store my local ID?
    2. When creating a SyncId, I can pass a SyncGlobalId instance. What is this classed used for and how?
    3. Since I don’t know if there is any other way, I'm trying to use custom fields in the provider Metadata to store local IDs. Is this a good approach?

    I know these are a lot of questions but after extensive search I couldn’t find satisfactory answers...

    Any help will be much appreciated.

     

    Best regards,

    Pedro Tenreiro

     

    • Moved by Max Wang_1983 Thursday, April 21, 2011 9:48 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Tuesday, August 12, 2008 6:39 PM

Answers

  • Hi Pedro -

     

    Your approach of using custom fields in the metadata to store local ids is correct. Since you typically need to look up items by local id - I would suggest creating an index on this "local id" custom column as well.

    1. When I create the ReplicaMetadata through the MetadataStore I pass a SyncIdFormatGroup where I define the ReplicaIdFormat and ItemIdFormat. Can I use one of these IDs to store my local ID?
      >>>>>> ReplicaId is a unique identified for your endpoint and ItemId denotes your GlobalId.
    2. When creating a SyncId, I can pass a SyncGlobalId instance. What is this classed used for and how?
      >>>>>> SyncGlobalId is a specific globalId that we have defined for you that contains a prefix and a unique guid. You can use this to denote your globalId if you choose or use any of the other supported types to denote your global id.
    3. Since I don’t know if there is any other way, I'm trying to use custom fields in the provider Metadata to store local IDs. Is this a good approach?
      >>>>>> Like I said above - you are correct in using the custom fields.

     

    Thanks

    Deepa

    1.  

     

    Thursday, August 21, 2008 7:52 PM
    Answerer