MergePartition MergePartition MergePartition Class

정의

매개 변수가 있는 행 필터를 사용하여 병합 게시에 대한 구독자의 파티션 정보를 나타냅니다. Represents information about a Subscriber's partition for a merge publication with a parameterized row filter.

public ref class MergePartition sealed
public sealed class MergePartition
Public NotInheritable Class MergePartition
상속
MergePartitionMergePartitionMergePartition

예제

// Define the server, database, and publication names
string publisherName = publisherInstance;
string publicationName = "AdvWorksSalesOrdersMerge";
string publicationDbName = "AdventureWorks2012";
string distributorName = publisherInstance;

MergePublication publication;
MergePartition partition;
MergeDynamicSnapshotJob snapshotAgentJob;
ReplicationAgentSchedule schedule;

// Create a connection to the Publisher.
ServerConnection publisherConn = new ServerConnection(publisherName);

// Create a connection to the Distributor to start the Snapshot Agent.
ServerConnection distributorConn = new ServerConnection(distributorName);

try
{
	// Connect to the Publisher.
	publisherConn.Connect();

	// Set the required properties for the publication.
	publication = new MergePublication();
	publication.ConnectionContext = publisherConn;
	publication.Name = publicationName;
	publication.DatabaseName = publicationDbName;


	// If we can't get the properties for this merge publication, 
	// then throw an application exception.
	if (publication.LoadProperties() || publication.SnapshotAvailable)
	{
		// Set a weekly schedule for the filtered data snapshot.
		schedule = new ReplicationAgentSchedule();
		schedule.FrequencyType = ScheduleFrequencyType.Weekly;
		schedule.FrequencyRecurrenceFactor = 1;
		schedule.FrequencyInterval = Convert.ToInt32(0x001);

		// Set the value of Hostname that defines the data partition. 
		partition = new MergePartition();
		partition.DynamicFilterHostName = hostname;
		snapshotAgentJob = new MergeDynamicSnapshotJob();
		snapshotAgentJob.DynamicFilterHostName = hostname;

		// Create the partition for the publication with the defined schedule.
		publication.AddMergePartition(partition);
		publication.AddMergeDynamicSnapshotJob(snapshotAgentJob, schedule);
	}
	else
	{
		throw new ApplicationException(String.Format(
			"Settings could not be retrieved for the publication, " +
			" or the initial snapshot has not been generated. " +
			"Ensure that the publication {0} exists on {1} and " +
			"that the Snapshot Agent has run successfully.",
			publicationName, publisherName));
	}
}
catch (Exception ex)
{
	// Do error handling here.
	throw new ApplicationException(string.Format(
		"The partition for '{0}' in the {1} publication could not be created.",
		hostname, publicationName), ex);
}
finally
{
	publisherConn.Disconnect();
	if (distributorConn.IsOpen) distributorConn.Disconnect();
}
' Define the server, database, and publication names
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publicationDbName As String = "AdventureWorks2012"
Dim distributorName As String = publisherInstance

Dim publication As MergePublication
Dim partition As MergePartition
Dim snapshotAgentJob As MergeDynamicSnapshotJob
Dim schedule As ReplicationAgentSchedule

' Create a connection to the Publisher.
Dim publisherConn As ServerConnection = New ServerConnection(publisherName)

' Create a connection to the Distributor to start the Snapshot Agent.
Dim distributorConn As ServerConnection = New ServerConnection(distributorName)

Try
    ' Connect to the Publisher.
    publisherConn.Connect()

    ' Set the required properties for the publication.
    publication = New MergePublication()
    publication.ConnectionContext = publisherConn
    publication.Name = publicationName
    publication.DatabaseName = publicationDbName


    ' If we can't get the properties for this merge publication, 
    ' then throw an application exception.
    If (publication.LoadProperties() Or publication.SnapshotAvailable) Then
        ' Set a weekly schedule for the filtered data snapshot.
        schedule = New ReplicationAgentSchedule()
        schedule.FrequencyType = ScheduleFrequencyType.Weekly
        schedule.FrequencyRecurrenceFactor = 1
        schedule.FrequencyInterval = Convert.ToInt32("0x001", 16)

        ' Set the value of Hostname that defines the data partition. 
        partition = New MergePartition()
        partition.DynamicFilterHostName = hostname
        snapshotAgentJob = New MergeDynamicSnapshotJob()
        snapshotAgentJob.DynamicFilterHostName = hostname

        ' Create the partition for the publication with the defined schedule.
        publication.AddMergePartition(partition)
        publication.AddMergeDynamicSnapshotJob(snapshotAgentJob, schedule)
    Else
        Throw New ApplicationException(String.Format( _
         "Settings could not be retrieved for the publication, " + _
         " or the initial snapshot has not been generated. " + _
         "Ensure that the publication {0} exists on {1} and " + _
         "that the Snapshot Agent has run successfully.", _
         publicationName, publisherName))
    End If
Catch ex As Exception
    ' Do error handling here.
    Throw New ApplicationException(String.Format( _
     "The partition for '{0}' in the {1} publication could not be created.", _
     hostname, publicationName), ex)
Finally
    publisherConn.Disconnect()
    If distributorConn.IsOpen Then
        distributorConn.Disconnect()
    End If
End Try

설명

이 네임 스페이스, 클래스 또는 멤버의 버전 2.0 에서만에서 지원 됩니다는 Microsoft .NET Framework입니다.This namespace, class, or member is supported only in version 2.0 of the Microsoft .NET Framework.

스레드 보안Thread Safety

모든 public static (Shared 에 Microsoft Visual Basic)이 형식의 멤버는 다중 스레드 작업에 안전 합니다.Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. 인스턴스 구성원은 스레드로부터의 안전성이 보장되지 않습니다.Any instance members are not guaranteed to be thread safe.

생성자

MergePartition() MergePartition() MergePartition()

새 인스턴스를 만듭니다는 MergePartition 클래스입니다. Creates a new instance of the MergePartition class.

속성

CurrentSnapshotDateTime CurrentSnapshotDateTime CurrentSnapshotDateTime

파티션의 데이터 스냅숏이 생성된 날짜 및 시간을 가져오거나 설정합니다. Gets or sets the date and time when the data snapshot of the partition was generated.

DynamicFilterHostName DynamicFilterHostName DynamicFilterHostName

[HOST_NAME (Transact SQL)]에 제공 되는 값을 가져오거나 설정 합니다. (http://msdn.microsoft.com/library/4b8b0705-c083-4b07-b954-c83ee73b2ebb) 이 함수를 사용 하 여 매개 변수가 있는 행 필터 정의 된 데이터 스냅숏을 생성 하는 함수입니다. Gets or sets the value supplied to the HOST_NAME (Transact-SQL) function to generate the data snapshot, when the parameterized row filter is defined using this function.

DynamicFilterLogin DynamicFilterLogin DynamicFilterLogin

[SUSER_SNAME (Transact SQL)]에 제공 되는 값을 가져오거나 설정 합니다. (http://msdn.microsoft.com/library/11ec7d86-d429-4004-a436-da25df9f8761) 이 함수를 사용 하 여 매개 변수가 있는 행 필터 정의 된 데이터 스냅숏을 생성 하는 함수입니다. Gets or sets the value supplied to the SUSER_SNAME (Transact-SQL) function to generate the data snapshot, when the parameterized row filter is defined using this function.

DynamicSnapshotJobId DynamicSnapshotJobId DynamicSnapshotJobId

구독자에 대 한 필터링된 된 스냅숏을 생성 하는 16 진수 형식의 Microsoft SQL Server 에이전트 작업 ID를 가져오거나 설정 합니다. Gets or sets the Microsoft SQL Server Agent job ID, in hexadecimal format, which generates the filtered snapshot for the Subscriber.

DynamicSnapshotLocation DynamicSnapshotLocation DynamicSnapshotLocation

파티션에 대해 생성되는 필터링된 스냅숏을 저장하는 데 사용되는 운영 체제 폴더를 가져오거나 설정합니다. Gets or sets the operating system folder used to store the filtered snapshot generated for the partition.

PartitionId PartitionId PartitionId

파티션을 고유하게 식별하는 ID 값을 가져오거나 설정합니다. Gets or sets the ID value that uniquely identifies the partition.

UserData UserData UserData

사용자 지정 데이터를 이 MergePartition 인스턴스에 연결할 수 있도록 하는 개체를 가져오거나 설정합니다. Gets or sets an object that allows you to attach custom data to this instance of MergePartition.

적용 대상

추가 정보