MergeArticle.ArticleResolver 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置同步项目时使用的自定义冲突解决程序或业务逻辑处理程序的友好名称。
public:
property System::String ^ ArticleResolver { System::String ^ get(); void set(System::String ^ value); };
public string ArticleResolver { get; set; }
member this.ArticleResolver : string with get, set
Public Property ArticleResolver As String
属性值
一个 String 值。
示例
// 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
注解
ArticleResolver属性可由发布服务器和订阅服务器 (的 sysadmin 固定服务器角色的成员检索,以便重新发布订阅服务器) 。 也可以由发布数据库上 db_owner 固定数据库角色的成员、分发服务器上的 replmonitor 固定数据库角色的成员以及发布访问列表成员的用户 (PAL) 检索。
属性 ArticleResolver 可由发布服务器上 sysadmin 固定服务器角色的成员设置。 也可以由发布数据库上 db_owner 固定数据库角色的成员设置。
检索 ArticleResolver 等效于执行 Transact-SQL) sp_helpmergearticle (。
设置 ArticleResolver 等效于执行 Transact-SQL) 或 sp_changemergearticle (Transact-SQL) sp_addmergearticle (。