다음을 통해 공유


MergeArticle 클래스

Represents an article in a merge publication.

상속 계층

System. . :: . .Object
  Microsoft.SqlServer.Replication. . :: . .ReplicationObject
    Microsoft.SqlServer.Replication. . :: . .Article
      Microsoft.SqlServer.Replication..::..MergeArticle

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

구문

‘선언
Public NotInheritable Class MergeArticle _
    Inherits Article
‘사용 방법
Dim instance As MergeArticle
public sealed class MergeArticle : Article
public ref class MergeArticle sealed : public Article
[<SealedAttribute>]
type MergeArticle =  
    class
        inherit Article
    end
public final class MergeArticle extends Article

MergeArticle 유형에서 다음 멤버를 표시합니다.

생성자

  이름 설명
공용 메서드 MergeArticle() () () () Creates a new instance of the MergeArticle class.
공용 메서드 MergeArticle(String, String, String, ServerConnection) Creates a new instance of the MergeArticle class with the specified name, publication, database, and connection to the instance of Microsoft SQL Server.

맨 위로 이동

속성

  이름 설명
공용 속성 AllowInteractiveResolver Gets or sets whether to allow subscriptions to invoke an interactive resolver when conflicts occur during synchronization.
공용 속성 ArticleId Gets the article ID value. (Article에서 상속됨)
공용 속성 ArticleResolver Gets or sets the friendly name of the custom conflict resolver or business logic handler used when synchronizing the article.
공용 속성 CachePropertyChanges Gets or sets whether to cache changes made to the replication properties or to apply them immediately. (ReplicationObject에서 상속됨)
공용 속성 CheckPermissions Gets or sets how the permissions are checked at the Publisher before changes are uploaded from a Subscriber.
공용 속성 ColumnTracking Gets or sets how conflicts are detected when synchronizing data rows.
공용 속성 CompensateForErrors Gets or sets whether compensating actions are taken when errors are encountered during synchronization.
공용 속성 ConflictTable Gets the name of the table used to track conflicts that occur when synchronizing a merge article.
공용 속성 ConnectionContext Gets or sets the connection to an instance of Microsoft SQL Server. (ReplicationObject에서 상속됨)
보호된 속성 CreateArticleAsHeterogeneous (Article에서 상속됨)
공용 속성 CreationScript Gets or sets the name and full path of the Transact-SQL script file that is used to create the destination object at the Subscriber. (Article에서 상속됨)
공용 속성 DatabaseName Gets or sets the name of the database that contains the data and the objects that are published in the article. (Article에서 상속됨)
공용 속성 DeleteTracking Gets or sets whether deletes are replicated.
공용 속성 Description Gets or sets a textual description of the article. (Article에서 상속됨)
공용 속성 DestinationObjectName Gets or sets the database object that is the source database object for the article at the Subscriber. (Article에서 상속됨)
공용 속성 DestinationObjectOwner Gets or sets the schema owner of the source database object for the article at the Subscriber. (Article에서 상속됨)
공용 속성 FilterClause Gets or sets the WHERE(Transact-SQL) clause that is evaluated to filter an article horizontally.
공용 속성 IdentityRangeManagementOption Gets or sets the identity range management options for the article. (Article에서 상속됨)
공용 속성 IdentityRangeThreshold Gets or sets the value at which a new range of identity column values are assigned to a Publisher or to a Subscriber. (Article에서 상속됨)
공용 속성 IsExistingObject Gets whether the object exists on the server or not. (ReplicationObject에서 상속됨)
공용 속성 MultipleColumnUpdate 인프라입니다.
공용 속성 Name Gets or sets the name of the article. (Article에서 상속됨)
공용 속성 PartitionOption Gets or sets the filtering options when an article is filtered using a parameterized row filter.
공용 속성 PreCreationMethod Gets or sets the action to take when the published object already exists in the subscription database. (Article에서 상속됨)
공용 속성 ProcessingOrder Gets or sets the processing order of the article during synchronization.
공용 속성 PublicationName Gets or sets the name of the publication to which the article belongs. (Article에서 상속됨)
공용 속성 PublisherIdentityRangeSize For a TransArticle object, gets or sets the range of identity values assigned to table columns at the Publisher. For a MergeArticle object, gets or sets the range of identity values assigned to table columns at Subscribers that have server subscriptions. (Article에서 상속됨)
공용 속성 ResolverInfo Gets or sets additional data and parameters that are to be used by a COM-based conflict resolver.
공용 속성 SchemaOption Gets or sets the schema creation options for an article. (Article에서 상속됨)
공용 속성 SnapshotObjectName Gets the name of the database object that represents the initial snapshot data for the article.
공용 속성 SnapshotObjectOwner Gets the owner of the database object that represents the initial snapshot data for the article.
공용 속성 SourceObjectName Gets or sets the name of the database object that is being published. (Article에서 상속됨)
공용 속성 SourceObjectOwner Gets or sets the owner of the database object that is being published. (Article에서 상속됨)
공용 속성 SqlServerName Gets the name of the Microsoft SQL Server instance to which this object is connected. (ReplicationObject에서 상속됨)
공용 속성 Status Gets or sets the status of the merge article.
공용 속성 StreamBlobColumns Gets or sets whether a data stream optimization is used when replicating binary large object (BLOB) columns.
공용 속성 SubscriberIdentityRangeSize Gets or sets the maximum number of new rows that can be inserted into an identity column in a table at a Subscriber before another identity range must be allocated. (Article에서 상속됨)
공용 속성 SubscriberUploadOption Gets or sets the behavior of updates made at a Subscriber with a client subscription.
공용 속성 Type Gets or sets the type of article. (Article에서 상속됨)
공용 속성 UserData Gets or sets an object property that allows users to attach their own data to the object. (ReplicationObject에서 상속됨)
공용 속성 VerifyResolverSignature Gets or sets the options for verifying the digital signature on a COM-based conflict resolver to determine if it is from a trusted source.
공용 속성 VerticalPartition Specifies whether all columns are published in a table article. (Article에서 상속됨)

맨 위로 이동

메서드

  이름 설명
공용 메서드 AddMergeJoinFilter Adds a join filter to the merge article.
공용 메서드 AddReplicatedColumns Adds the specified columns to the merge article.
공용 메서드 ChangeMergeJoinFilter Changes a join filter that defined on a merge article.
보호된 메서드 CheckValidCreation 인프라입니다. (Article에서 상속됨)
보호된 메서드 CheckValidDefinition 인프라입니다. (Article에서 상속됨)
공용 메서드 CommitPropertyChanges Sends all the cached property change statements to the instance of Microsoft SQL Server. (ReplicationObject에서 상속됨)
공용 메서드 Create Creates a new article on the currently connected instance of SQL Server based on the current properties of the TransArticle object or the MergeArticle object. (Article에서 상속됨)
공용 메서드 Decouple Decouples the referenced replication object from the server. (ReplicationObject에서 상속됨)
공용 메서드 EnumMergeJoinFilters Returns the join filters that are defined for the merge article.
공용 메서드 Equals (Object에서 상속됨)
보호된 메서드 Finalize (Object에서 상속됨)
보호된 메서드 GetChangeCommand 인프라입니다. (ReplicationObject에서 상속됨)
보호된 메서드 GetCreateCommand 인프라입니다. (ReplicationObject에서 상속됨)
보호된 메서드 GetDropCommand 인프라입니다. (ReplicationObject에서 상속됨)
공용 메서드 GetHashCode (Object에서 상속됨)
공용 메서드 GetType (Object에서 상속됨)
공용 메서드 InitializeSharedPropertiesBasedOnExistingArticles 인프라입니다.
보호된 메서드 InternalRefresh 인프라입니다. (ReplicationObject에서 상속됨)
공용 메서드 ListReplicatedColumns Returns the columns that exist in a vertically partitioned article.
공용 메서드 Load Loads the properties of an existing object from the server. (ReplicationObject에서 상속됨)
공용 메서드 LoadProperties Loads the properties of an existing object from the server. (ReplicationObject에서 상속됨)
보호된 메서드 MemberwiseClone (Object에서 상속됨)
공용 메서드 Refresh Reloads the properties of the object. (ReplicationObject에서 상속됨)
공용 메서드 Remove Removes an existing article on the currently connected instance of SQL Server based on the current properties of the TransArticle object or the MergeArticle object. (Article에서 상속됨)
공용 메서드 RemoveMergeJoinFilter Removes the specified merge join filter from the article.
공용 메서드 RemoveReplicatedColumns Removes existing columns from a vertically partitioned article.
공용 메서드 Script Generates a Transact-SQL script that can be executed to create or delete the TransArticle object or the MergeArticle object on the server. (Article에서 상속됨)
공용 메서드 ScriptMergeJoinFilter Returns a Transact-SQL script of the merge join filter attached to the merge article.
공용 메서드 ToString (Object에서 상속됨)

맨 위로 이동

주의

This namespace, class, or member is supported only in version 2.0 of the Microsoft .NET Framework.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

This example creates three merge articles and their related join filters.

         // Define the Publisher and publication names.
            string publisherName = publisherInstance;
            string publicationName = "AdvWorksSalesOrdersMerge";
            string publicationDbName = "AdventureWorks2008R2";

            // Specify article names.
            string articleName1 = "Employee";
            string articleName2 = "SalesOrderHeader";
            string articleName3 = "SalesOrderDetail";

            // Specify join filter information.
            string filterName12 = "SalesOrderHeader_Employee";
            string filterClause12 = "Employee.BusinessEntityID = " +
                "SalesOrderHeader.SalesPersonID";
            string filterName23 = "SalesOrderDetail_SalesOrderHeader";
            string filterClause23 = "SalesOrderHeader.SalesOrderID = " +
                "SalesOrderDetail.SalesOrderID";

            string salesSchema = "Sales";
            string hrSchema = "HumanResources";

            MergeArticle article1 = new MergeArticle();
            MergeArticle article2 = new MergeArticle();
            MergeArticle article3 = new MergeArticle();
            MergeJoinFilter filter12 = new MergeJoinFilter();
            MergeJoinFilter filter23 = new MergeJoinFilter();

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

            // Create three merge articles that are horizontally partitioned
            // using a parameterized row filter on Employee.BusinessEntityID, which is 
            // extended to the two other articles using join filters. 
            try
            {
                // Connect to the Publisher.
                conn.Connect();

                // Create each article. 
                // For clarity, each article is defined separately. 
                // In practice, iterative structures and arrays should 
                // be used to efficiently create multiple articles.

                // Set the required properties for the Employee article.
                article1.ConnectionContext = conn;
                article1.Name = articleName1;
                article1.DatabaseName = publicationDbName;
                article1.SourceObjectName = articleName1;
                article1.SourceObjectOwner = hrSchema;
                article1.PublicationName = publicationName;
                article1.Type = ArticleOptions.TableBased;

                // Define the parameterized filter clause based on Hostname.
                article1.FilterClause = "Employee.LoginID = HOST_NAME()";

                // Set the required properties for the SalesOrderHeader article.
                article2.ConnectionContext = conn;
                article2.Name = articleName2;
                article2.DatabaseName = publicationDbName;
                article2.SourceObjectName = articleName2;
                article2.SourceObjectOwner = salesSchema;
                article2.PublicationName = publicationName;
                article2.Type = ArticleOptions.TableBased;

                // Set the required properties for the SalesOrderDetail article.
                article3.ConnectionContext = conn;
                article3.Name = articleName3;
                article3.DatabaseName = publicationDbName;
                article3.SourceObjectName = articleName3;
                article3.SourceObjectOwner = salesSchema;
                article3.PublicationName = publicationName;
                article3.Type = ArticleOptions.TableBased;

                if (!article1.IsExistingObject) article1.Create();
                if (!article2.IsExistingObject) article2.Create();
                if (!article3.IsExistingObject) article3.Create();

                // Select published columns for SalesOrderHeader.
                // Create an array of column names to vertically filter out.
                // In this example, only one column is removed.
                String[] columns = new String[1];

                columns[0] = "CreditCardApprovalCode";

                // Remove the column.
                article2.RemoveReplicatedColumns(columns);

                // Define a merge filter clauses that filter 
                // SalesOrderHeader based on Employee and 
                // SalesOrderDetail based on SalesOrderHeader. 

                // Parent article.
                filter12.JoinArticleName = articleName1;
                // Child article.
                filter12.ArticleName = articleName2;
                filter12.FilterName = filterName12;
                filter12.JoinUniqueKey = true;
                filter12.FilterTypes = FilterTypes.JoinFilter;
                filter12.JoinFilterClause = filterClause12;

                // Add the join filter to the child article.
                article2.AddMergeJoinFilter(filter12);

                // Parent article.
                filter23.JoinArticleName = articleName2;
                // Child article.
                filter23.ArticleName = articleName3;
                filter23.FilterName = filterName23;
                filter23.JoinUniqueKey = true;
                filter23.FilterTypes = FilterTypes.JoinFilter;
                filter23.JoinFilterClause = filterClause23;

                // Add the join filter to the child article.
                article3.AddMergeJoinFilter(filter23);
            }
            catch (Exception ex)
            {
                // Do error handling here and rollback the transaction.
                throw new ApplicationException(
                    "The filtered articles could not be created", ex);
            }
            finally
            {
                conn.Disconnect();
            }
' Define the Publisher and publication names.
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publicationDbName As String = "AdventureWorks2008R2"

' Specify article names.
Dim articleName1 As String = "Employee"
Dim articleName2 As String = "SalesOrderHeader"
Dim articleName3 As String = "SalesOrderDetail"

' Specify join filter information.
Dim filterName12 As String = "SalesOrderHeader_Employee"
Dim filterClause12 As String = "Employee.BusinessEntityID = " + _
    "SalesOrderHeader.SalesPersonID"
Dim filterName23 As String = "SalesOrderDetail_SalesOrderHeader"
Dim filterClause23 As String = "SalesOrderHeader.SalesOrderID = " + _
    "SalesOrderDetail.SalesOrderID"

Dim salesSchema As String = "Sales"
Dim hrSchema As String = "HumanResources"

Dim article1 As MergeArticle = New MergeArticle()
Dim article2 As MergeArticle = New MergeArticle()
Dim article3 As MergeArticle = New MergeArticle()
Dim filter12 As MergeJoinFilter = New MergeJoinFilter()
Dim filter23 As MergeJoinFilter = New MergeJoinFilter()

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

' Create three merge articles that are horizontally partitioned
' using a parameterized row filter on Employee.BusinessEntityID, which is 
' extended to the two other articles using join filters. 
Try
    ' Connect to the Publisher.
    conn.Connect()

    ' Create each article. 
    ' For clarity, each article is defined separately. 
    ' In practice, iterative structures and arrays should 
    ' be used to efficiently create multiple articles.

    ' Set the required properties for the Employee article.
    article1.ConnectionContext = conn
    article1.Name = articleName1
    article1.DatabaseName = publicationDbName
    article1.SourceObjectName = articleName1
    article1.SourceObjectOwner = hrSchema
    article1.PublicationName = publicationName
    article1.Type = ArticleOptions.TableBased

    ' Define the parameterized filter clause based on Hostname.
    article1.FilterClause = "Employee.LoginID = HOST_NAME()"

    ' Set the required properties for the SalesOrderHeader article.
    article2.ConnectionContext = conn
    article2.Name = articleName2
    article2.DatabaseName = publicationDbName
    article2.SourceObjectName = articleName2
    article2.SourceObjectOwner = salesSchema
    article2.PublicationName = publicationName
    article2.Type = ArticleOptions.TableBased

    ' Set the required properties for the SalesOrderDetail article.
    article3.ConnectionContext = conn
    article3.Name = articleName3
    article3.DatabaseName = publicationDbName
    article3.SourceObjectName = articleName3
    article3.SourceObjectOwner = salesSchema
    article3.PublicationName = publicationName
    article3.Type = ArticleOptions.TableBased

    ' Create the articles, if they do not already exist.
    If article1.IsExistingObject = False Then
        article1.Create()
    End If
    If article2.IsExistingObject = False Then
        article2.Create()
    End If
    If article3.IsExistingObject = False Then
        article3.Create()
    End If

    ' Select published columns for SalesOrderHeader.
    ' Create an array of column names to vertically filter out.
    ' In this example, only one column is removed.
    Dim columns() As String = New String(0) {}

    columns(0) = "CreditCardApprovalCode"

    ' Remove the column.
    article2.RemoveReplicatedColumns(columns)

    ' Define a merge filter clauses that filter 
    ' SalesOrderHeader based on Employee and 
    ' SalesOrderDetail based on SalesOrderHeader. 

    ' Parent article.
    filter12.JoinArticleName = articleName1
    ' Child article.
    filter12.ArticleName = articleName2
    filter12.FilterName = filterName12
    filter12.JoinUniqueKey = True
    filter12.FilterTypes = FilterTypes.JoinFilter
    filter12.JoinFilterClause = filterClause12

    ' Add the join filter to the child article.
    article2.AddMergeJoinFilter(filter12)

    ' Parent article.
    filter23.JoinArticleName = articleName2
    ' Child article.
    filter23.ArticleName = articleName3
    filter23.FilterName = filterName23
    filter23.JoinUniqueKey = True
    filter23.FilterTypes = FilterTypes.JoinFilter
    filter23.JoinFilterClause = filterClause23

    ' Add the join filter to the child article.
    article3.AddMergeJoinFilter(filter23)

Catch ex As Exception
    ' Do error handling here and rollback the transaction.
    Throw New ApplicationException( _
        "The filtered articles could not be created", ex)
Finally
    conn.Disconnect()
End Try

This example changes and existing merge article to associate a business logic handler with the article. For more information, see 방법: 병합 아티클에 대한 비즈니스 논리 처리기 구현(RMO 프로그래밍).

            // Define the Publisher, publication, and article names.
            string publisherName = publisherInstance;
            string publicationName = "AdvWorksSalesOrdersMerge";
            string publicationDbName = "AdventureWorks2008R2";
            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 = "AdventureWorks2008R2"
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

스레드 보안

이 유형의 모든 공용 static(Visual Basic에서는 Shared) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.