Метод Script
Создание содержащей код SQL строки для подготовки базы данных для определенной области с помощью соединения указанного в конструкторе.
Пространство имен: Microsoft.Synchronization.Data.SqlServer
Сборка: Microsoft.Synchronization.Data.SqlServer (в Microsoft.Synchronization.Data.SqlServer.dll)
Синтаксис
'Декларация
Public Function Script As String
'Применение
Dim instance As SqlSyncScopeProvisioning
Dim returnValue As String
returnValue = instance.Script()
public string Script()
public:
String^ Script()
member Script : unit -> string
public function Script() : String
Возвращаемое значение
Тип System. . :: . .String
Код SQL для провизионирования базы данных.
Примеры
В следующем примере кода создается объект провизионирования для области filtered_customer и указывается, что все объекты, связанные с синхронизацией, должны быть созданы в схеме базы данных с именем "Sync". В ходе провизионирования области код определяет фильтр для таблицы Customer. Синхронизироваться будут только строки, выполняющие условие фильтра. Для таблицы CustomerContact фильтр не определяется, и поэтому синхронизироваться будут все строки из этой таблицы. После определения параметров провизионирования вызывается метод Apply, чтобы создать инфраструктуру отслеживания изменений в серверной базе данных, а скрипт провизионирования записывается в файл. Чтобы просмотреть этот код в контексте полного примера, см. раздел Как настроить и выполнить синхронизацию базы данных (SQL Server).
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(serverConn, scopeDesc);
serverConfig.ObjectSchema = "Sync";
// Specify which column(s) in the Customer table to use for filtering data,
// and the filtering clause to use against the tracking table.
// "[side]" is an alias for the tracking table.
serverConfig.Tables["Sales.Customer"].AddFilterColumn("CustomerType");
serverConfig.Tables["Sales.Customer"].FilterClause = "[side].[CustomerType] = 'Retail'";
// Configure the scope and change-tracking infrastructure.
serverConfig.Apply();
// Write the configuration script to a file. You can modify
// this script if necessary and run it against the server
// to customize behavior.
File.WriteAllText("SampleConfigScript.txt",
serverConfig.Script());
Dim serverConfig As New SqlSyncScopeProvisioning(serverConn, scopeDesc)
serverConfig.ObjectSchema = "Sync"
' Specify which column(s) in the Customer table to use for filtering data,
' and the filtering clause to use against the tracking table.
' "[side]" is an alias for the tracking table.
serverConfig.Tables("Sales.Customer").AddFilterColumn("CustomerType")
serverConfig.Tables("Sales.Customer").FilterClause = "[side].[CustomerType] = 'Retail'"
' Configure the scope and change-tracking infrastructure.
serverConfig.Apply()
' Write the configuration script to a file. You can modify
' this script if necessary and run it against the server
' to customize behavior.
File.WriteAllText("SampleConfigScript.txt", serverConfig.Script())
См. также
Справочник
SqlSyncScopeProvisioning Класс