SelectScopeInfoCommand 属性

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

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

语法

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

value = instance.SelectScopeInfoCommand

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

属性值

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

注释

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

示例

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

SqlCommand selReplicaInfoCmd = new SqlCommand();
selReplicaInfoCmd.CommandType = CommandType.Text;
selReplicaInfoCmd.CommandText = "SELECT " +
                                "scope_id, " +
                                "scope_local_id, " +
                                "scope_sync_knowledge, " +
                                "scope_tombstone_cleanup_knowledge, " +
                                "scope_timestamp " +
                                "FROM Sync.ScopeInfo " +
                                "WHERE scope_name = @" + DbSyncSession.SyncScopeName;
selReplicaInfoCmd.Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100);

sampleProvider.SelectScopeInfoCommand = selReplicaInfoCmd;
Dim selReplicaInfoCmd As New SqlCommand()

With selReplicaInfoCmd
    .CommandType = CommandType.Text
    .CommandText = "SELECT " _
                 & "scope_id, " _
                 & "scope_local_id, " _
                 & "scope_sync_knowledge, " _
                 & "scope_tombstone_cleanup_knowledge, " _
                 & "scope_timestamp " _
                 & "FROM Sync.ScopeInfo " _
                 & "WHERE scope_name = @" + DbSyncSession.SyncScopeName
    .Parameters.Add("@" + DbSyncSession.SyncScopeName, SqlDbType.NVarChar, 100)
End With

sampleProvider.SelectScopeInfoCommand = selReplicaInfoCmd

请参阅

参考

DbSyncProvider类

DbSyncProvider 成员

Microsoft.Synchronization.Data 命名空间