MergeArticle.ArticleResolver 속성

Gets or sets the friendly name of the custom conflict resolver or business logic handler used when synchronizing the article.

네임스페이스:  Microsoft.SqlServer.Replication
어셈블리:  Microsoft.SqlServer.Rmo(Microsoft.SqlServer.Rmo.dll)

public string ArticleResolver { get; set; }

속성 값

유형: System.String
A String value.

The ArticleResolver property can be retrieved by members of the sysadmin fixed server role at the Publisher and at the Subscriber (for republishing Subscribers). It can also be retrieved by members of the db_owner fixed database role on the publication database, by members of the replmonitor fixed database role at the Distributor, and by users who are members of the publication access list (PAL).

The ArticleResolver property can be set by members of the sysadmin fixed server role at the Publisher. It can also be set by members of the db_owner fixed database role on the publication database.

Retrieving ArticleResolver is equivalent to executing sp_helpmergearticle(Transact-SQL).

Setting ArticleResolver is equivalent to executing sp_add_targetservergroup(Transact-SQL) or sp_changemergearticle(Transact-SQL).

			// Define the Publisher, publication, and article names.
			string publisherName = publisherInstance;
			string publicationName = "AdvWorksSalesOrdersMerge";
			string publicationDbName = "AdventureWorks2012";
			string articleName = "SalesOrderHeader";
			
			// Set the friendly name of the business logic handler.
			string customLogic = "OrderEntryLogic";

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

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

				// Set the required properties for the article.
				article.ConnectionContext = conn;
				article.Name = articleName;
				article.DatabaseName = publicationDbName;
				article.PublicationName = publicationName;

				// Load the article properties.
				if (article.LoadProperties())
				{
					article.ArticleResolver = customLogic;
				}
				else
				{
					// Throw an exception of the article does not exist.
					throw new ApplicationException(String.Format(
					"{0} is not published in {1}", articleName, publicationName));
				}
				
			}
			catch (Exception ex)
			{
				// Do error handling here and rollback the transaction.
				throw new ApplicationException(String.Format(
					"The business logic handler {0} could not be associated with " +
					" the {1} article.",customLogic,articleName), ex);
			}
			finally
			{
				conn.Disconnect();
			}
' Define the Publisher, publication, and article names.
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publicationDbName As String = "AdventureWorks2012"
Dim articleName As String = "SalesOrderHeader"

' Set the friendly name of the business logic handler.
Dim customLogic As String = "OrderEntryLogic"

Dim article As MergeArticle = New MergeArticle()

' 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 article.
    article.ConnectionContext = conn
    article.Name = articleName
    article.DatabaseName = publicationDbName
    article.PublicationName = publicationName

    ' Load the article properties.
    If article.LoadProperties() Then
        article.ArticleResolver = customLogic
    Else
        ' Throw an exception of the article does not exist.
        Throw New ApplicationException(String.Format( _
         "{0} is not published in {1}", articleName, publicationName))
    End If

Catch ex As Exception
    ' Do error handling here and rollback the transaction.
    Throw New ApplicationException(String.Format( _
     "The business logic handler {0} could not be associated with " + _
     " the {1} article.", customLogic, articleName), ex)
Finally
    conn.Disconnect()
End Try

커뮤니티 추가 항목

추가
표시: