开发者

Microsoft Sync Framework. Applying "Scope" to an existing SqlCe database

Is it possible to apply a DbSyncScopeDescription to an existing SqlCeDatabase?

I'm trying to provision an existing database using a DbSyncScopeDescription built from this database.

This is the code i'm using to test this out. This should give you an idea of what I'm trying to do.

I get a SqlCeException on the last line with the message:

"The specified index does not exist. [ sysChangeTxBsn_idx ]".

private void Test()
{
    DbSyncScopeDescription scopeDescription =
       new DbSyncScopeDescription("MyScope");

    foreach (string tableName in TableNames)
    {
        DbSyncTableDescription tableDecsription = SqlCeSyncDescriptionBuilder
            .GetDescriptionForTable(tableName, myConnection);
        scopeDescription.Tables.Add(tableDecsription);
    }

    SqlCeSyncScopeProvision开发者_开发知识库ing scopeProvisioning =
        new SqlCeSyncScopeProvisioning(scopeDescription);
    scopeProvisioning.SetCreateTableDefault(DbSyncCreationOption.Create); 
    scopeProvisioning.Apply(myConnection);
}

Please let me know if this is possible or if I'm doing something wrong. Thank you, Alex


One thing that I would try is to use the Skip enumeration value in the call to SetCreateTableDefault.

scopeProvisioning.SetCreateTableDefault(DbSyncCreationOption.Skip);

The tables are already present in the database and you do not need to create them.

Also, I have had problems provisioning SQL Server Compact Edition databases in the past if change tracking has already been enabled.

Cheers,

Scott

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜