locked
Knowledge Only Situation RRS feed

  • Question

  • Hi All,

    I'm just looking into the SyncFramework and am having a few problems.

    So far playing around with the FileSyncProvider I have merged the contents of two folders and had a little play around with it and all is well.  The problem I'm having is just using a subset of features.

    What I need to do is simply compare a users collection of files on their HDD to the knowledge metadata stored about the same collection of files.

    I don't want to perform a simple compare and then merge two locations of data.  I have set-up two replicas in a test and set the FileSyncOptions to FileSyncOptions.ExplicitDetectChanges to just perform ChangeDetection but then on the call to agent.Syncronize() it complains with an error:

    InvalidOperationException
    Both LocalProvider and RemoteProvider must be set.

    I have also tried to just run the detect pass using sourceReplica.DetectChanges(); but I'm stuck on getting the data about the changes.

    All I really need is to get a list of local directories paths that have changes compared to the last time the DetectChanges() method was run on the replica.

    jammer
    • Moved by Max Wang_1983 Thursday, April 21, 2011 5:51 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Wednesday, March 4, 2009 11:38 PM

Answers

  • Hi there,

    All the ExplicitDetectChanges flag does is allow you (the application) to control when change detection happens.  ie when the flag is set the changedetection will not run automatically before a sync, only when you explicitly call it.

    As for your error, are you setting the LocalProvider and RemoteProvider properties to valid instances of the FSP?  If you don't want to sync you shouldn't call Synchronize().

    It sounds like your scenario is not a sync scenario.  The FSP uses our metadata store to store the metadata so you'd have to open that store and look at the fields within to determine what has changed.

    -Jesse
    Thursday, March 5, 2009 10:53 PM

All replies

  • Hi there,

    All the ExplicitDetectChanges flag does is allow you (the application) to control when change detection happens.  ie when the flag is set the changedetection will not run automatically before a sync, only when you explicitly call it.

    As for your error, are you setting the LocalProvider and RemoteProvider properties to valid instances of the FSP?  If you don't want to sync you shouldn't call Synchronize().

    It sounds like your scenario is not a sync scenario.  The FSP uses our metadata store to store the metadata so you'd have to open that store and look at the fields within to determine what has changed.

    -Jesse
    Thursday, March 5, 2009 10:53 PM
  • Hi Jesse,

    Indeed your right it's not a sync scenario.  It's a single provider scenario.  The code I'm using now is:

    1            FileSyncProvider sourceReplica = new FileSyncProvider(sourceID.GetGuidId(), pathToMonitor, 
    2                                                                  new FileSyncScopeFilter(),  
    3                                                                  FileSyncOptions.ExplicitDetectChanges,  
    4                                                                  metaDataLocation,  
    5                                                                  metaDataFile,  
    6                                                                  metaDataLocation,  
    7                                                                  null); 
    8            sourceReplica.DetectChanges(); 
    9             
    10            SqlMetadataStore _store = SqlMetadataStore.OpenStore(System.IO.Path.Combine(metaDataLocation,metaDataFile), CultureInfo.CurrentCulture); 
    11            ReplicaMetadata _metaData = _store.GetReplicaMetadata(new SyncIdFormatGroup(), sourceID); 
    12            SyncKnowledge sk = _metaData.GetKnowledge(); 

    However, when I run this I get a MetaDataStorageEngineException with the message:

    A storage engine operation failed with error code  (HRESULT = 0x80040E21, Source IID = {0C733A8B-2A1C-11CE-ADE5-00AA0044773D}).

    Is this an SqlServerCe version problem?  I only have SqlCe 3.5 in the GAC.

    Thanks!

    jammer
    Friday, March 6, 2009 6:37 PM
  • Is the exception thrown on the GetKnowledge() line?
    Monday, March 9, 2009 5:40 PM
  • Hi Jesse,

    No, that particular error happens on the OpenStore() line ...

    If I comment out the FileSyncProvider line and rerun the code I still get the same error.  I tried that since I'd read that you can only issue OpenStore() once and that when the provider creates the store is implicitly calls OpenStore() after creating the metadatastore.

    If I just keep rerunning the FileSyncProvider I'm sure its internally re-opening the metadatastore file, not creating a new one each time so its seems to be able to open the store.

    I'm very confused over this at the moment.  Any ideas would be great ...

    Regards,

    James.

    jammer
    Monday, March 9, 2009 6:45 PM