Export (0) Print
Expand All

ReplicationObject.CommitPropertyChanges Method ()


Applies To: SQL Server 2016 Preview

Sends all the cached property change statements to the instance of Microsoft SQL Server.

Namespace:   Microsoft.SqlServer.Replication
Assembly:  Microsoft.SqlServer.Rmo (in Microsoft.SqlServer.Rmo.dll)

public void CommitPropertyChanges()

The statements are stored or executed depending on the SqlExecutionModes property of the ServerConnection object.

Legacy Code Example

			// 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);

				// Connect to the Publisher.

				// 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.
					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);
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft