다음을 통해 공유


SqlSyncScopeProvisioning.SetCreateTableDefault 메서드

범위가 구성될 때 기본 테이블을 만들지 여부를 설정합니다.

네임스페이스: Microsoft.Synchronization.Data.SqlServer
어셈블리: microsoft.synchronization.data.sqlserver.dll의 Microsoft.Synchronization.Data.SqlServer

구문

‘선언
Public Sub SetCreateTableDefault ( _
    defaultOption As DbSyncCreationOption _
)
‘사용 방법
Dim instance As SqlSyncScopeProvisioning
Dim defaultOption As DbSyncCreationOption

instance.SetCreateTableDefault(defaultOption)
public void SetCreateTableDefault (
    DbSyncCreationOption defaultOption
)
public:
void SetCreateTableDefault (
    DbSyncCreationOption defaultOption
)
public void SetCreateTableDefault (
    DbSyncCreationOption defaultOption
)
public function SetCreateTableDefault (
    defaultOption : DbSyncCreationOption
)

매개 변수

  • defaultOption
    기본 테이블을 만들지 여부를 지정하는 DbSyncCreationOption 열거형 값입니다.

주의

기본 테이블이 이미 데이터베이스에 있고 DbSyncTableDescription 개체를 사용하여 테이블 스키마를 정의하지 않을 경우 Skip의 값을 지정합니다.

예제

다음 코드 예제에서는 filtered_customer 범위에 대한 프로비전 개체를 만들고, 기본 테이블이 서버 데이터베이스에서 만들어지지 않도록 지정하고, 모든 동기화 관련 개체가 "Sync"라는 이름의 데이터베이스 스키마에서 만들어지도록 지정합니다. 범위 프로비전의 일부로 코드에서 Customer 테이블에 대한 필터를 정의합니다. 필터와 일치하는 행만 동기화됩니다. CustomerContact 테이블에는 필터가 정의되어 있지 않으므로 해당 테이블의 모든 행이 동기화됩니다. 프로비전 옵션을 정의한 후 Apply 메서드를 호출하여 서버 데이터베이스에 변경 내용 추적 인프라를 만들고 프로비전 스크립트를 파일로 작성합니다. 전체 예제의 맥락에서 이 코드를 보려면 방법: 공동 작업 동기화 구성 및 실행(SQL Server)을 참조하십시오.

SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(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(serverConn);

// 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("SyncSamplesDb_SqlPeer1"));
Dim serverConfig As New SqlSyncScopeProvisioning(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(serverConn)

' 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("SyncSamplesDb_SqlPeer1"))

참고 항목

참조

SqlSyncScopeProvisioning 클래스
SqlSyncScopeProvisioning 멤버
Microsoft.Synchronization.Data.SqlServer 네임스페이스