FilterClause を追加した後、削除が機能しなくなりました。
JuneTは、Users_tracking である追跡テーブルのフィルターを言った
ただし、Users_tracking に IsPublished 列が表示されません。UserId しか表示されません。
ご協力ありがとうございました!
private static void ProvisionLocal(
SqlConnection sqlLocalConn, DbSyncScopeDescription scopeDesc)
{
var Users = SqlSyncDescriptionBuilder
.GetDescriptionForTable("Users", sqlLocalConn);
scopeDesc.Tables.Add(Users);
var sqlLocalProv = new SqlSyncScopeProvisioning(sqlLocalConn, scopeDesc);
sqlLocalProv.CommandTimeout = 3600;
sqlLocalProv.Tables["Users"].AddFilterColumn("IsPublished");
sqlLocalProv.Tables["Users"].FilterClause =
string.Format("[side].[IsPublished] = {0}", 1);
if (!sqlLocalProv.ScopeExists("TestScope"))
{
sqlLocalProv.Apply();
}
}
private static void ProvisionRemote(
SqlConnection sqlRemoteConn, DbSyncScopeDescription scopeDesc)
{
var sqlRemoteProv = new SqlSyncScopeProvisioning(sqlRemoteConn, scopeDesc);
sqlRemoteProv.CommandTimeout = 3600;
if (!sqlRemoteProv.ScopeExists("TestScope"))
{
// Apply the scope provisioning.
sqlRemoteProv.Apply();
}
}
public void Synchronize()
{
var sqlSourceConn = new SqlConnection("...");
var sqlDestinationConn = new SqlConnection("...");
var scopeDesc = new DbSyncScopeDescription("TestScope");
ProvisionLocal(type, sqlSourceConn, scopeDesc);
ProvisionRemote(type, sqlDestinationConn, scopeDesc);
// Prepare for synchronization
var localProvider = new SqlSyncProvider("TestScope", sqlSourceConn);
var remoteProvider = new SqlSyncProvider("TestScope", sqlDestinationConn);
remoteProvider.ApplyChangeFailed += RemoteProvider_ApplyChangeFailed;
var orch = new SyncOrchestrator();
orch.RemoteProvider = remoteProvider;
orch.LocalProvider = localProvider;
orch.Direction = SyncDirectionOrder.Upload;
SyncOperationStatistics stats = orch.Synchronize();
sqlDestinationConn.Close();
sqlSourceConn.Close();
}