locked
Batching the initial download RRS feed

  • Question

  • Hi,

    So I'm looking at the AnchorEnumerationSimpleSync provider to sync records from a webservice. Each record has a Last Modified Date timestamp on it which is going to be my anchor.

    The question is, the first time the tool is run, it could potentially run in to a download of 1000s of records. The web service supports retrieving the records in batch mode. So I can break the download in to batches of 100. However, I'm not quite sure how to support this from the sync provider.

    Given that my _store abstracts the calls to the webservice, is the following the right way to go about it?

    public override void EnumerateChanges(byte[] anchor, AnchorEnumerationContext context)
    {
    if (anchor == null)
    {
    var batch = _store.GetChangesInBatches();
    while (batch != null)
    {
    context.ReportChanges(itemChanges,
    BitConverter.GetBytes(DateTime.Today.ToBinary()));
    batch = _store.GetNextBatch();
    }
    }
    }
    Monday, November 15, 2010 7:03 AM