Can you select which column to sync with Sync Fram

2020-08-04 09:26发布

问题:

I notice that with MS Sync, going through the wizard to create the WCF service that will do the sync, you can only choose which table to sync.

Is it possible to only sync a few columns of the table and not the entire table? It will also create the local sdf file with the whole table structure. I only need a few columns of the table to be displayed in my mobile device.

回答1:

You can achieve this by writing code. You can use the DbSyncTableDescription

DbSyncTableDescription tableDescription = SqlSyncDescriptionBuilder.GetDescriptionForTable(tableName, Collection<Columns>, server Connection)

The second parameter is the collection of Column Names you want to include in Sync.

Hope that helps



回答2:

The Sync Framework is a customizable and extensible framework hence it can surly be done. But you probably have to write some code - I am not aware that the database synchronization provider included in the framework supports synchronizing only a subset of the columns.