UpdateScopeInfoCommand 属性

获取或设置一个 IDbCommand 对象,该对象包含更新对等数据库中的作用域元数据的查询或存储过程。

命名空间:  Microsoft.Synchronization.Data
程序集:  Microsoft.Synchronization.Data(在 Microsoft.Synchronization.Data.dll 中)

语法

声明
Public Overridable Property UpdateScopeInfoCommand As IDbCommand
    Get
    Set
用法
Dim instance As DbSyncProvider
Dim value As IDbCommand

value = instance.UpdateScopeInfoCommand

instance.UpdateScopeInfoCommand = value
public virtual IDbCommand UpdateScopeInfoCommand { get; set; }
public:
virtual property IDbCommand^ UpdateScopeInfoCommand {
    IDbCommand^ get ();
    void set (IDbCommand^ value);
}
abstract UpdateScopeInfoCommand : IDbCommand with get, set
override UpdateScopeInfoCommand : IDbCommand with get, set
function get UpdateScopeInfoCommand () : IDbCommand
function set UpdateScopeInfoCommand (value : IDbCommand)

属性值

类型:System.Data. . :: . .IDbCommand
包含查询或存储过程的 IDbCommand 对象。

注释

此命令更新来自作用域元数据表的信息,例如 Sync Framework 所需的同步知识和清除知识。有关如何使用作用域的更多信息,请参见如何为协作同步设置服务器数据库(非 SQL Server)中的“创建用于存储元数据的跟踪表”。 

示例

以下代码示例指定一条更新每个对等数据库的作用域表中元数据的命令。若要在完整示例的上下文中查看此代码,请参见如何为协作同步设置服务器数据库(非 SQL Server)

SqlCommand updReplicaInfoCmd = new SqlCommand();
updReplicaInfoCmd.CommandType = CommandType.Text;
updReplicaInfoCmd.CommandText = "UPDATE  Sync.ScopeInfo SET " +
                                "scope_sync_knowledge = @" + DbSyncSession.SyncScopeKnowledge + ", " +
                                "scope_id = @" + DbSyncSession.SyncScopeId + ", " +
                                "scope_tombstone_cleanup_knowledge = @" + DbSyncSession.SyncScopeCleanupKnowledge + " " +
                                "WHERE scope_name = @" + DbSyncSession.SyncScopeName + " AND " +
                                " ( @" + DbSyncSession.SyncCheckConcurrency + " = 0 OR scope_timestamp = @" + DbSyncSession.SyncScopeTimestamp + "); " +
                                "set @" + DbSyncSession.SyncRowCount + " = @@rowcount";
updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeKnowledge, SqlDbType.VarBinary, 10000);
updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeCleanupKnowledge, SqlDbType.VarBinary, 10000);
updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100);
updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncCheckConcurrency, SqlDbType.Int);
updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeId, SqlDbType.UniqueIdentifier);
updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeTimestamp, SqlDbType.BigInt);
updReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output;

sampleProvider.UpdateScopeInfoCommand = updReplicaInfoCmd;
Dim updReplicaInfoCmd As New SqlCommand()

With updReplicaInfoCmd
    .CommandType = CommandType.Text
    .CommandText = "UPDATE  Sync.ScopeInfo SET " _
                 & "scope_sync_knowledge = @" + DbSyncSession.SyncScopeKnowledge + ", " _
                 & "scope_id = @" + DbSyncSession.SyncScopeId + ", " _
                 & "scope_tombstone_cleanup_knowledge = @" + DbSyncSession.SyncScopeCleanupKnowledge + " " _
                 & "WHERE scope_name = @" + DbSyncSession.SyncScopeName + " AND " _
                 & " ( @" + DbSyncSession.SyncCheckConcurrency + " = 0 OR scope_timestamp = @" + DbSyncSession.SyncScopeTimestamp + "); " _
                 & "set @" + DbSyncSession.SyncRowCount + " = @@rowcount"
    .Parameters.Add("@" + DbSyncSession.SyncScopeKnowledge, SqlDbType.VarBinary, 10000)
    .Parameters.Add("@" + DbSyncSession.SyncScopeCleanupKnowledge, SqlDbType.VarBinary, 10000)
    .Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100)
    .Parameters.Add("@" + DbSyncSession.SyncCheckConcurrency, SqlDbType.Int)
    .Parameters.Add("@" + DbSyncSession.SyncScopeId, SqlDbType.UniqueIdentifier)
    .Parameters.Add("@" + DbSyncSession.SyncScopeTimestamp, SqlDbType.BigInt)
    .Parameters.Add("@" + DbSyncSession.SyncRowCount, SqlDbType.Int).Direction = ParameterDirection.Output
End With

sampleProvider.UpdateScopeInfoCommand = updReplicaInfoCmd

请参阅

参考

DbSyncProvider类

DbSyncProvider 成员

Microsoft.Synchronization.Data 命名空间