Заблокировано Selective Synchronization

  • 10 grudnia 2009 18:02
     
     
    I have set up sync services to synch a SQL CE database with SQL Server Express.  Is there an easy way to selectively synch only a subset of the tables in the database.  For example, my database has about 20-25 tables...suppose I only want to synch 3-4 tables in a certain situation and not all of them?  I have looked at SyncGroups and it doesn't appear to do that.

    Thanks,
    Chuck
    • Przeniesiony przez Max Wang_Chinasoft 20 kwietnia 2011 21:45 Forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    •  

Wszystkie odpowiedzi

  • 10 grudnia 2009 19:50
     
     
    I believe you are asking how to sync only subset of tables within a database for a scope. within DbSyncScopeDescription class, there is member called Tables.

    This is a collection which you can modify to select tables which you would like to include in sync scope.

    Hope this helps,

    Patrick
  • 10 grudnia 2009 20:47
     
     
    Great!  That was exactly what I was looking for!

    Only one problem...the DbSyncScopeDescription class doesn't seem to be included in the version of Sync Services I have.  I looked for it in:

    Microsoft.Synchronization.Data

    and it's not there.  I know it exists because I found examples on the web of people using it.

    I am using VS 2008 and I have .Net Framework 3.5 SP1 installed and I have all the latest updates.  I attempted to download the Sync Framework v2.0 SDK to make sure I had that and it told me I already have a newer version.  I have downloaded the Sync Services redistributable.

    Any idea what I'm missing?

    Thanks,

    Chuck
    Chuck
  • 10 grudnia 2009 23:45
     
     

    So, I apologize in advance for the confustion. From what you describe, you are using OCS v1, in which there is no DbSyncScopeDescription class. Ignore what I said above.

    Instead, what you can do is simply on SyncAgent, there is a property called Configuration. This Configuration also contains a property called SyncTables.

    This is also a collection of tables to be included in this sync. Only add the SyncTables that you intend to sync.

    Hope this helps.

    Patrick 

  • 11 grudnia 2009 00:03
     
     
    OK, I'll give that a shot.  I thought I had the latest version of Sync Services...if not, can you please advise how I get the latest version?

    Thanks,
    Chuck
  • 11 grudnia 2009 00:35
     
     
    Sync Services can be downloaded from this page. In particular, the DatabaseProviders msi contains the latest database synchronization classes.

    Microsoft Sync Framework 2.0 Redistributable Package:

    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=109db36e-cdd0-4514-9fb5-b77d9cea37f6

    To look at samples, documentation on classes and etc, download SDK as well:

    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=89adbb1e-53ff-41b5-ba17-8e43a2e66254

    Here are the sample gallery on the web:
    http://code.msdn.microsoft.com/sync

    In particular, the one you might be interested in is this one:
    Database Sync - SQL Server and SQL Server Compact (using DatabaseProviders)
    http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3422

    Hope this helps.

    FYI: if you intend to use OCS v1, Visual Studio wizard should allow you to select the tables you want to sync. If you try to do this manually in code, then the above reply is valid. Also, you need to add SyncAdapters for those tables to DbServerSyncProvider.SyncAdapters property.

    Patrick
  • 11 grudnia 2009 02:29
     
     

    Thanks, Patrick...you've been VERY helpful.

    I still have one problem...I downloaded and installed everything on the page you referenced:

    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=89adbb1e-53ff-41b5-ba17-8e43a2e66254

    and I still don't see that class under Microsoft.Synchronization.Data   I also searched for it in the object browser and found no trace of it there.

    I still must be missing an installation.

    Thanks,


    Chuck
  • 11 grudnia 2009 18:38
     
     
    You need to install

    Microsoft Sync Framework 2.0 Redistributable Package: Particularly, the Synchronization and DatabaseProviders msi

    http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=109db36e-cdd0-4514-9fb5-b77d9cea37f6

    SDK only contains documenation, samples, and etc...

    Thanks,

    Patrick
  • 11 grudnia 2009 22:40
     
     

    I have installed all the downloads from the reference you provided and it's still not there.


    Chuck
  • 12 grudnia 2009 01:12
     
     Odpowiedz
    Could you try manually adding reference to the dll's?

    %program files%/microsoft sync framework/2.0/runtime/ado.net/v3.0/%cpu arch%/Microsoft.Synchronization.Data.dll
    %program files%/microsoft sync framework/2.0/runtime/ado.net/v3.0/%cpu arch%/Microsoft.Synchronization.Data.Server.dll
    %program files%/microsoft sync framework/2.0/runtime/ado.net/v3.0/%cpu arch%/Microsoft.Synchronization.Data.SqlServer.dll
    %program files%/microsoft sync framework/2.0/runtime/ado.net/v3.0/%cpu arch%/Microsoft.Synchronization.Data.SqlServerCe.dll

    Patrick
  • 14 grudnia 2009 16:08
     
     
    I was able to manually add these references to my project file and I can now see the v2.0 objects I was missing.  FYI, I tried uninstalling all versions of Sync Framework and reinstalling v2.0 and it still didn't register these references.  I had to add them manually.

    Thanks,

    Chuck
    Chuck
  • 16 grudnia 2009 20:05
     
      Zawiera kod
    I am continuing to have some really screwy versioning problems with Sync Services on my system...I have attempted to cleanup the references, get rid of version 1.0 completely and only use version 2.0.  I thought I had switched over everything to version 2.0, but when I attempt to compile the project, I get the following message:

    Found conflicts between different versions of the same dependent assembly

    It's definitely related to Sync services, because when I click on this error, it asks me if I want to fix these conflicts by adding binding redirect records in the app.config file.  If I answer "Yes" to that, it inserts the following in the app.config file for one of my assemblies:

    	<runtime>
    		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    			<dependentAssembly>
    				<assemblyIdentity name="Microsoft.Synchronization.Data" publicKeyToken="89845DCD8080CC91" culture="neutral"/>
    				<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
    			</dependentAssembly>
    		</assemblyBinding>
    	</runtime>
    I have checked all of my assemblies and there is only one assembly that directly references Microsoft.Synchronization and I'm sure I've set that one to only reference v2.0.  Some other item I'm using must be referencing an older v1.0 reference - I don't think I'm referencing it directly.  Any thoughts on how I can resolve this?

    Thanks,

    Chuck