次の方法で共有


MergeArticle.ArticleResolver プロパティ

アーティクルの同期に使用されるカスタム競合回避モジュールまたはビジネス ロジック ハンドラーの表示名を取得します。値の設定も可能です。

名前空間:  Microsoft.SqlServer.Replication
アセンブリ:  Microsoft.SqlServer.Rmo (Microsoft.SqlServer.Rmo.dll)

構文

'宣言
Public Property ArticleResolver As String 
    Get 
    Set
'使用
Dim instance As MergeArticle 
Dim value As String 

value = instance.ArticleResolver

instance.ArticleResolver = value
public string ArticleResolver { get; set; }
public:
property String^ ArticleResolver {
    String^ get ();
    void set (String^ value);
}
member ArticleResolver : string with get, set
function get ArticleResolver () : String 
function set ArticleResolver (value : String)

プロパティ値

型: System.String
String 値です。

説明

ArticleResolver プロパティを取得できるのは、パブリッシャー側およびサブスクライバー側 (サブスクライバーを再パブリッシュする場合) の固定サーバー ロール sysadmin のメンバーです。 また、パブリケーション データベースの固定データベース ロール db_owner のメンバー、ディストリビューター側の固定データベース ロール replmonitor のメンバー、およびパブリケーション アクセス リスト (PAL) のメンバーも取得できます。

ArticleResolver プロパティを設定できるのは、パブリッシャー側の固定サーバー ロール sysadmin のメンバーです。 また、パブリケーション データベースの固定データベース ロール db_owner のメンバーも設定できます。

ArticleResolver を取得すると、sp_helpmergearticle (Transact-SQL) を実行したのと同じことになります。

ArticleResolver を設定すると、sp_addmergearticle (Transact-SQL) または 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

関連項目

参照

MergeArticle クラス

Microsoft.SqlServer.Replication 名前空間