取得或設定代表範圍中資料表的 DbSyncTableDescription 物件清單。
命名空間: Microsoft.Synchronization.Data
組件: Microsoft.Synchronization.Data (在 microsoft.synchronization.data.dll)
語法
'宣告
Public ReadOnly Property Tables As DbSyncTableDescriptionCollection
'用途
Dim instance As DbSyncScopeDescription
Dim value As DbSyncTableDescriptionCollection
value = instance.Tables
public DbSyncTableDescriptionCollection Tables { get; }
public:
property DbSyncTableDescriptionCollection^ Tables {
DbSyncTableDescriptionCollection^ get ();
}
/** @property */
public DbSyncTableDescriptionCollection get_Tables ()
public function get Tables () : DbSyncTableDescriptionCollection
屬性值
代表範圍中資料表的 DbSyncTableDescription 物件清單。
範例
下列程式碼範例會描述名為 filtered_customer 的範圍,並且新增三個資料表到此範圍:Customer、CustomerContact 和 NewTable。前兩個資料表已經在伺服器資料庫中,所以使用 GetDescriptionForTable 方法從伺服器資料庫擷取結構描述。雖然此範圍包含 Customer 資料表中的所有資料行,不過只包含 CustomerContact 資料表中的兩個資料行。NewTable 資料表是使用 DbSyncTableDescription 和 DbSyncColumnDescription 物件定義,然後在伺服器資料庫 (以及要與它同步處理的資料庫) 中建立此資料表。若要在完整範例的內容中檢視這段程式碼,請參閱 HOW TO:設定及執行共同作業同步處理 (SQL Server)。
DbSyncTableDescription newTableDescription = new DbSyncTableDescription("Sales.NewTable");
DbSyncColumnDescription newTableIdCol = new DbSyncColumnDescription();
DbSyncColumnDescription newTableContentCol = new DbSyncColumnDescription();
newTableIdCol.UnquotedName = "NewTableId";
newTableIdCol.Type = "int";
newTableIdCol.IsPrimaryKey = true;
newTableContentCol.UnquotedName = "NewTableContent";
newTableContentCol.Type = "nvarchar";
newTableContentCol.Size = "100";
newTableContentCol.IsPrimaryKey = false;
newTableDescription.Columns.Add(newTableIdCol);
newTableDescription.Columns.Add(newTableContentCol);
scopeDesc.Tables.Add(newTableDescription);
Dim newTableDescription As New DbSyncTableDescription("Sales.NewTable")
Dim newTableIdCol As New DbSyncColumnDescription()
Dim newTableContentCol As New DbSyncColumnDescription()
newTableIdCol.UnquotedName = "NewTableId"
newTableIdCol.Type = "int"
newTableIdCol.IsPrimaryKey = True
newTableContentCol.UnquotedName = "NewTableContent"
newTableContentCol.Type = "nvarchar"
newTableContentCol.Size = "100"
newTableContentCol.IsPrimaryKey = False
newTableDescription.Columns.Add(newTableIdCol)
newTableDescription.Columns.Add(newTableContentCol)
scopeDesc.Tables.Add(newTableDescription)
請參閱
參考
DbSyncScopeDescription 類別
DbSyncScopeDescription 成員
Microsoft.Synchronization.Data 命名空間