SqlSyncScopeProvisioning Class
Represents the provisioning of a SQL Server database for a particular scope that is represented by a DbSyncScopeDescription object.
Inheritance Hierarchy
System.Object
Microsoft.Synchronization.Data.SqlServer.SqlSyncScopeProvisioning
Namespace: Microsoft.Synchronization.Data.SqlServer
Assembly: Microsoft.Synchronization.Data.SqlServer (in Microsoft.Synchronization.Data.SqlServer.dll)
Syntax
'Declaration
Public Class SqlSyncScopeProvisioning
'Usage
Dim instance As SqlSyncScopeProvisioning
public class SqlSyncScopeProvisioning
public ref class SqlSyncScopeProvisioning
type SqlSyncScopeProvisioning = class end
public class SqlSyncScopeProvisioning
The SqlSyncScopeProvisioning type exposes the following members.
Constructors
Name | Description | |
---|---|---|
SqlSyncScopeProvisioning() | Obsolete. Initializes a new instance of the SqlSyncScopeProvisioning class by using default values. | |
SqlSyncScopeProvisioning(SqlConnection) | Initializes a new instance of the SqlSyncScopeProvisioning class with the specified connection. | |
SqlSyncScopeProvisioning(DbSyncScopeDescription) | Obsolete. Initializes a new instance of the SqlSyncScopeProvisioning class for the specified scope. | |
SqlSyncScopeProvisioning(SqlConnection, DbSyncScopeDescription) | Initializes a new instance of the SqlSyncScopeProvisioning class with the specified connection and scope description. | |
SqlSyncScopeProvisioning(SqlConnection, SqlSyncScopeProvisioningType) | Initializes a new instance of the SqlSyncScopeProvisioning class with the specified connection and provisioning type | |
SqlSyncScopeProvisioning(SqlConnection, DbSyncScopeDescription, SqlSyncScopeProvisioningType) | Initializes a new instance of the SqlSyncScopeProvisioning class with the specified connection, scope description, and provisioning type. |
Top
Properties
Name | Description | |
---|---|---|
CommandTimeout | Gets or sets the wait time, in seconds, before a provisioning command is stopped and an error is generated. | |
ObjectPrefix | Gets or sets the optional prefix that is used to identify objects that Sync Framework creates. | |
ObjectSchema | Gets or sets the database schema in which Sync Framework creates objects. | |
ScopeName | Gets the name of the scope or template that this object represents. | |
Tables | Gets a collection of objects that each represent the provisioning of a database table. | |
UserComment | Gets or sets the user-specified comment about the scope. |
Top
Methods
Name | Description | |
---|---|---|
Apply() | Applies the provisioning script to a SQL Server database by using the connection that was specified in the constructor. | |
Apply(SqlConnection) | Obsolete. Applies the provisioning script to a SQL Server database over the specified connection. | |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
PopulateFromScopeDescription | Sets the scope description from which the database should be provisioned. | |
PopulateFromTemplate | Sets the template-based scope description from which the database should be provisioned. | |
ScopeExists(String) | Indicates whether the specified scope exists in the database by using the connection that was specified in the constructor. | |
ScopeExists(String, SqlConnection) | Obsolete. Returns whether the specified scope exists. | |
Script() | Generates a string that contains the SQL code to provision the database for a particular scope by using the connection that was specified in the constructor. | |
Script(String) | Obsolete. Generates a string that contains the SQL code to provision the database for a particular scope. | |
SetCreateProceduresDefault | Sets whether to create a set of stored procedures that insert, update, and delete data and synchronization metadata. The default setting is CreateOrUseExisting. | |
SetCreateProceduresForAdditionalScopeDefault | Sets whether to create additional stored procedures for a scope that contains tables that have already been provisioned for other scopes. For example, this scope adds a filter column to a table that has already been provisioned without the filter column. Set this option to Create to ensure that an additional change enumeration procedure is created that can handle the filter column. The default setting is Skip. | |
SetCreateTableDefault | Sets whether to create base tables when a scope is configured. Base tables are tables that contain user data, as opposed to tracking tables that contain synchronization metadata. The default setting is CreateOrUseExisting. | |
SetCreateTrackingTableDefault | Sets whether to create tables that store change-tracking metadata. The default setting is CreateOrUseExisting. | |
SetCreateTriggersDefault | Sets whether to create, on base tables, triggers that update tracking tables. The default setting is CreateOrUseExisting. | |
SetPopulateTrackingTableDefault | Sets whether to insert metadata into change-tracking tables for rows that already exist in base tables. The default setting is CreateOrUseExisting. | |
SetUseBulkProceduresDefault | Sets a value that indicates whether bulk procedures should be created when provisioning stored procedures. The default setting is true when provisioning a SQL Server 2008 or SQL Azure database; otherwise, it is false. | |
TemplateExists | Returns whether the specified template exists in the database. | |
ToString | (Inherited from Object.) |
Top
Examples
The following code example creates a provisioning object for the filtered_customer scope, specifies that base tables should not be created in the server database, and specifies that all synchronization-related objects should be created in a database schema named "Sync". As part of provisioning the scope, the code defines a filter on the Customer table. Only rows that match that filter will be synchronized. No filter is defined on the CustomerContact table; therefore all rows from that table will be synchronized. After provisioning options are defined, the Apply method is called to create the change-tracking infrastructure in the server database; and the provisioning script is written to a file. To view this code in the context of a complete example, see How To: Execute Database Synchronization (SQL Server).
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(serverConn, scopeDesc);
serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
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.SetCreateTableDefault(DbSyncCreationOption.Skip)
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())
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.