locked
List<Guid> as a SyncParameter RRS feed

  • Question

  • I want to filter my sync with more than one value of a SyncParameter.

    Is it possible to have a list of values as a SyncParameter?

     

    SyncAdapter: (Server)

     

    this.SelectIncrementalUpdatesCommand.CommandText = @"SELECT * FROM MyTable WHERE ([LastEditDate] > @sync_last_received_anchor AND [LastEditDate] <= @sync_new_received_anchor AND [CreationDate] <= @sync_last_received_anchor AND [UserID] IN @MyGuidList)";

     

    this.SelectIncrementalUpdatesCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@MyGuidList", typeof(List<Guid>)));

     

    SyncAgent: (Client)

    LeguanCacheSyncAgent syncAgent = new LeguanCacheSyncAgent();

    Guid User1 = new Guid("8c508381-6d85-4623-91ce-1d8b53123373");

    Guid User2 = new Guid("50cf77ee-f9ac-4a17-a243-6ea6662a85e3"); 

    Guid[] resultList = new Guid[2];

    resultList[0] = User1;

    resultList[1] = User2;

    syncAgent.Configuration.SyncParameters.Add("ResultUserID", resultList);

     

    syncStats = syncAgent.Synchronize();

     

     

     

    Is this type of filter possible with the Syncronization Services or do I have to throw it out and write my own?

    Can somebody please point in the right direction on this?

     

    /Christer

     

    • Moved by Max Wang_1983 Friday, April 22, 2011 10:08 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, September 3, 2007 1:31 PM

All replies

  • Hi,

     

    I don't think this is possible. This is not a limitation of sync services, though. ADO.NET does not allow you to write such statement. I think you need to break down the @MyGuidList to individual guids, for example, (@MyGuid1, @MyGuid2, @MyGuid3 ...) etc

     

    Hope that helps,

    Thanks

     

    Wednesday, September 12, 2007 5:31 PM