共用方式為


SqlSyncProvider.ScopeName 屬性

設定要同步處理的範圍名稱,這個範圍是具有選擇性篩選的邏輯資料表群組。

此屬性與 CLS 不相容。  

命名空間: Microsoft.Synchronization.Data.SqlServer
組件: Microsoft.Synchronization.Data.SqlServer (在 microsoft.synchronization.data.sqlserver.dll)

語法

'宣告
Public Overrides WriteOnly Property ScopeName As String
'用途
Dim instance As SqlSyncProvider
Dim value As String

instance.ScopeName = value
public override string ScopeName { set; }
public:
virtual property String^ ScopeName {
    void set (String^ value) override;
}
/** @property */
public void set_ScopeName (String value)
public override function set ScopeName (value : String)

屬性值

要同步處理的範圍名稱。

範例

下列程式碼範例是使用 DbSyncScopeDescription 物件來指定 SqlSyncProvider 物件的範圍,而不是直接設定 ScopeName。若要在完整範例的內容中檢視這段程式碼,請參閱 HOW TO:設定及執行共同作業同步處理 (SQL Server)

DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription("filtered_customer");

// Definition for Customer.
DbSyncTableDescription customerDescription =
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.Customer", serverConn);

scopeDesc.Tables.Add(customerDescription);

// Definition for CustomerContact, including the list of columns to include.
Collection<string> columnsToInclude = new Collection<string>();
columnsToInclude.Add("CustomerId");
columnsToInclude.Add("PhoneType");
DbSyncTableDescription customerContactDescription =
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.CustomerContact", columnsToInclude, serverConn);

scopeDesc.Tables.Add(customerContactDescription);
Dim scopeDesc As New DbSyncScopeDescription("filtered_customer")

' Definition for Customer. 
Dim customerDescription As DbSyncTableDescription = _
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.Customer", serverConn)

scopeDesc.Tables.Add(customerDescription)


' Definition for CustomerContact, including the list of columns to include. 
Dim columnsToInclude As New Collection(Of String)()
columnsToInclude.Add("CustomerId")
columnsToInclude.Add("PhoneType")
Dim customerContactDescription As DbSyncTableDescription = _
    SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.CustomerContact", columnsToInclude, serverConn)

scopeDesc.Tables.Add(customerContactDescription)

請參閱

參考

SqlSyncProvider 類別
SqlSyncProvider 成員
Microsoft.Synchronization.Data.SqlServer 命名空間