ReplicationObject.CachePropertyChanges ReplicationObject.CachePropertyChanges ReplicationObject.CachePropertyChanges Property

정의

복제 속성에 대한 변경 내용을 캐시할지 아니면 즉시 적용할지를 가져오거나 설정합니다. Gets or sets whether to cache changes made to the replication properties or to apply them immediately.

public:
 property bool CachePropertyChanges { bool get(); void set(bool value); };
public bool CachePropertyChanges { get; set; }
Public Property CachePropertyChanges As Boolean
속성 값

A Boolean 값입니다. A Boolean value. true이면 속성 변경이 캐시됩니다. If true, the property changes are cached. false이면 속성 변경이 즉시 적용됩니다. If false, the property changes are applied immediately.

예제

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

TransPublication publication;

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

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

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

	// Explicitly enable caching of property changes on this object.
	publication.CachePropertyChanges = true;

	// If we can't get the properties for this publication, 
	// throw an application exception.
	if (publication.LoadProperties())
	{
		// Enable support for push subscriptions and disable support 
		// for pull subscriptions.
		if ((publication.Attributes & PublicationAttributes.AllowPull) != 0)
		{
			publication.Attributes ^= PublicationAttributes.AllowPull;
		}
		if ((publication.Attributes & PublicationAttributes.AllowPush) == 0)
		{
			publication.Attributes |= PublicationAttributes.AllowPush;
		}

		// Send changes to the server.
		publication.CommitPropertyChanges();
	}
	else
	{
		throw new ApplicationException(String.Format(
			"Settings could not be retrieved for the publication. " +
			"Ensure that the publication {0} exists on {1}.",
			publicationName, publisherName));
	}
}
catch (Exception ex)
{
	// Do error handling here.
	throw new ApplicationException(
		"The publication property could not be changed.", ex);
}
finally
{
	conn.Disconnect();
}
' Define the server, database, and publication names
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksProductTran"
Dim publicationDbName As String = "AdventureWorks2012"

Dim publication As TransPublication

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

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

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

    ' Explicitly enable caching of property changes on this object.
    publication.CachePropertyChanges = True

    ' If we can't get the properties for this publication, 
    ' throw an application exception.
    If publication.LoadProperties() Then
        ' Enable support for push subscriptions and disable support 
        ' for pull subscriptions.
        If (publication.Attributes And PublicationAttributes.AllowPull) <> 0 Then
            publication.Attributes = publication.Attributes _
            Xor PublicationAttributes.AllowPull
        End If
        If (publication.Attributes And PublicationAttributes.AllowPush) = 0 Then
            publication.Attributes = publication.Attributes _
            Or PublicationAttributes.AllowPush
        End If

        ' Send changes to the server.
        publication.CommitPropertyChanges()
    Else
        Throw New ApplicationException(String.Format( _
         "Settings could not be retrieved for the publication. " + _
         "Ensure that the publication {0} exists on {1}.", _
         publicationName, publisherName))
    End If
Catch ex As Exception
    ' Do error handling here.
    Throw New ApplicationException( _
        "The publication property could not be changed.", ex)
Finally
    conn.Disconnect()
End Try

설명

때의 값 CachePropertyChangesfalse, 속성 변경에 따라 즉시 설정 되는 <xref:Microsoft.SqlServer.Management.Common.ServerConnection.SqlExecutionModes%2A> 속성은 <xref:Microsoft.SqlServer.Management.Common.ServerConnection> 개체입니다.When the value of CachePropertyChanges is false, property changes are immediately set according to the <xref:Microsoft.SqlServer.Management.Common.ServerConnection.SqlExecutionModes%2A> property of the <xref:Microsoft.SqlServer.Management.Common.ServerConnection> object. 값으로 설정 되 면 true, 속성이 변경 될 때까지 캐시 됩니다 CommitPropertyChanges 호출 됩니다.When the value is set to true, property changes will be cached until CommitPropertyChanges is called. CommitPropertyChanges 호출 후의 모든 속성 변경 내용은 CachePropertyChanges 에 따라 설정 되었는지는 <xref:Microsoft.SqlServer.Management.Common.ServerConnection.SqlExecutionModes%2A> 속성입니다.When CommitPropertyChanges is called, all property changes after CachePropertyChanges are set according to the <xref:Microsoft.SqlServer.Management.Common.ServerConnection.SqlExecutionModes%2A> property.

캐시에 저장 된 속성에만 적용 됩니다 Microsoft SQL Server합니다.Caching only applies to properties stored in Microsoft SQL Server.

기본값 CachePropertyChangesfalse합니다.The default value of CachePropertyChanges is false.

적용 대상