我有一个本地SQL CE数据库,我正在尝试使用Microsoft Sync Framework同步到远程SQL Server数据库。我已经配置了CE和服务器数据库,但是当我尝试使用SyncOrchestrator
进行同步时,我收到错误The stored procedure '[tablename_selectchanges]' doesn't exist.
。
在配置本地和远程数据库时,我首先启用对相应表的跟踪,然后执行以下操作:
CE:
var localScopeDescription = new DbSyncScopeDescription(scopeName);
foreach (var table in tables) {
localScopeDescription.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable(table, remoteConnection));
}
var localDatabaseConfiguration = new SqlCeSyncScopeProvisioning(localConnection, localScopeDescription);
if (!localDatabaseConfiguration.ScopeExists(scopeName)) {
localDatabaseConfiguration.ObjectPrefix = "Sync";
localDatabaseConfiguration.SetCreateTableDefault(DbSyncCreationOption.Skip);
localDatabaseConfiguration.Apply();
}
服务器:
var remoteScopeDescription = new DbSyncScopeDescription(scopeName);
foreach (var table in tables) {
remoteScopeDescription.Tables.Add(SqlCeSyncDescriptionBuilder.GetDescriptionForTable(table, localConnection));
}
var remoteDatabaseConfiguration = new SqlSyncScopeProvisioning(remoteConnection, remoteScopeDescription);
if (!remoteDatabaseConfiguration.ScopeExists(scopeName)) {
remoteDatabaseConfiguration.ObjectPrefix = "Sync";
remoteDatabaseConfiguration.SetCreateTableDefault(DbSyncCreationOption.Skip);
remoteDatabaseConfiguration.SetCreateTrackingTableDefault(DbSyncCreationOption.Create);
remoteDatabaseConfiguration.SetCreateTriggersDefault(DbSyncCreationOption.Create);
remoteDatabaseConfiguration.SetCreateProceduresDefault(DbSyncCreationOption.Skip);
remoteDatabaseConfiguration.SetPopulateTrackingTableDefault(DbSyncCreationOption.Create);
remoteDatabaseConfiguration.SetUseBulkProceduresDefault(true);
remoteDatabaseConfiguration.Apply();
}
如果我删除了SetCreateProceduresDefault(DbSyncCreationOption.Skip)
行,这似乎阻止了此过程的创建,我收到以下错误:
无效的列名'__sysChangeTxBsn'。
无效的列名'__sysInsertTxBsn'。
列名'__sysTrackingContext'无效。
我是否设置了配置错误,如果是,我该如何解决这个问题?或者这些错误是否可能由其他原因引起?