TransArticle 생성자

정의

TransArticle 클래스의 새 인스턴스를 만듭니다.

오버로드

TransArticle()

TransArticle 클래스의 새 인스턴스를 만듭니다.

TransArticle(String, String, String, ServerConnection)

필요한 속성과 Microsoft SQL Server 인스턴스 TransArticle 에 대한 지정된 연결을 사용하여 클래스의 새 인스턴스를 만듭니다.

설명

업데이트된 텍스트:2006년 7월 17일

다음 표에서는 새 인스턴스 TransArticle에 대한 기본 속성 값을 보여줍니다. 이 테이블에서 명시적으로 열거되지 않은 속성은 모두 값으로 null 초기화됩니다.

속성 기본값
CachePropertyChanges false
CommandFormat NoneCommandOptions
DatatypeMappingOptions DefaultArticleDatatypeMappingOptions
DeleteCommand CALL sp_MSdel_table1
IdentityRangeManagementOption ManualIdentityRangeManagementOption
InsertCommand CALL sp_MSins_table1
IsExistingObject false
PreCreationMethod DropPreCreationOption
SchemaOption PrimaryObjectCreationScriptOptions
Type LogBasedArticleOptions
UpdateCommand SCALL sp_MSupd_table1
VerticalPartition false

1 자세한 내용은 트랜잭션 아티클 및 sp_addarticle(Transact-SQL)의 @del_cmd, @ins_cmd@upd_cmd 매개 변수에 대해 변경 내용이 전파되는 방법 지정을 참조하세요.

TransArticle()

TransArticle 클래스의 새 인스턴스를 만듭니다.

public:
 TransArticle();
public TransArticle ();
Public Sub New ()

예제

// Define the Publisher, publication, and article names.
string publisherName = publisherInstance;
string publicationName = "AdvWorksProductTran";
string publicationDbName = "AdventureWorks2012";
string articleName = "Product";
string schemaOwner = "Production";

TransArticle article;

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

// Create a filtered transactional articles in the following steps:
// 1) Create the  article with a horizontal filter clause.
// 2) Add columns to or remove columns from the article.
try
{
    // Connect to the Publisher.
    conn.Connect();

    // Define a horizontally filtered, log-based table article.
    article = new TransArticle();
    article.ConnectionContext = conn;
    article.Name = articleName;
    article.DatabaseName = publicationDbName;
    article.SourceObjectName = articleName;
    article.SourceObjectOwner = schemaOwner;
    article.PublicationName = publicationName;
    article.Type = ArticleOptions.LogBased;
    article.FilterClause = "DiscontinuedDate IS NULL";

    // Ensure that we create the schema owner at the Subscriber.
    article.SchemaOption |= CreationScriptOptions.Schema;

    if (!article.IsExistingObject)
    {
        // Create the article.
        article.Create();
    }
    else
    {
        throw new ApplicationException(String.Format(
            "The article {0} already exists in publication {1}.",
            articleName, publicationName));
    }

    // Create an array of column names to remove from the article.
    String[] columns = new String[1];
    columns[0] = "DaysToManufacture";

    // Remove the column from the article.
    article.RemoveReplicatedColumns(columns);
}
catch (Exception ex)
{
    // Implement appropriate error handling here.
    throw new ApplicationException("The article could not be created.", ex);
}
finally
{
    conn.Disconnect();
}
' Define the Publisher, publication, and article names.
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksProductTran"
Dim publicationDbName As String = "AdventureWorks2012"
Dim articleName As String = "Product"
Dim schemaOwner As String = "Production"

Dim article As TransArticle

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

' Create a filtered transactional articles in the following steps:
' 1) Create the  article with a horizontal filter clause.
' 2) Add columns to or remove columns from the article.
Try
    ' Connect to the Publisher.
    conn.Connect()

    ' Define a horizontally filtered, log-based table article.
    article = New TransArticle()
    article.ConnectionContext = conn
    article.Name = articleName
    article.DatabaseName = publicationDbName
    article.SourceObjectName = articleName
    article.SourceObjectOwner = schemaOwner
    article.PublicationName = publicationName
    article.Type = ArticleOptions.LogBased
    article.FilterClause = "DiscontinuedDate IS NULL"

    ' Ensure that we create the schema owner at the Subscriber.
    article.SchemaOption = article.SchemaOption Or _
    CreationScriptOptions.Schema

    If Not article.IsExistingObject Then
        ' Create the article.
        article.Create()
    Else
        Throw New ApplicationException(String.Format( _
         "The article {0} already exists in publication {1}.", _
         articleName, publicationName))
    End If

    ' Create an array of column names to remove from the article.
    Dim columns() As String = New String(0) {}
    columns(0) = "DaysToManufacture"

    ' Remove the column from the article.
    article.RemoveReplicatedColumns(columns)
Catch ex As Exception
    ' Implement appropriate error handling here.
    Throw New ApplicationException("The article could not be created.", ex)
Finally
    conn.Disconnect()
End Try

설명

기본 생성자는 모든 필드를 기본값으로 초기화합니다.

적용 대상

TransArticle(String, String, String, ServerConnection)

필요한 속성과 Microsoft SQL Server 인스턴스 TransArticle 에 대한 지정된 연결을 사용하여 클래스의 새 인스턴스를 만듭니다.

public:
 TransArticle(System::String ^ name, System::String ^ publicationName, System::String ^ databaseName, Microsoft::SqlServer::Management::Common::ServerConnection ^ connectionContext);
public TransArticle (string name, string publicationName, string databaseName, Microsoft.SqlServer.Management.Common.ServerConnection connectionContext);
new Microsoft.SqlServer.Replication.TransArticle : string * string * string * Microsoft.SqlServer.Management.Common.ServerConnection -> Microsoft.SqlServer.Replication.TransArticle
Public Sub New (name As String, publicationName As String, databaseName As String, connectionContext As ServerConnection)

매개 변수

name
String

아티클의 이름을 지정하는 String 값입니다.

publicationName
String

트랜잭션 또는 스냅숏 게시의 이름을 지정하는 String 값입니다.

databaseName
String

게시 데이터베이스의 이름을 지정하는 String 값입니다.

connectionContext
ServerConnection

게시자에 대한 연결을 지정하는 ServerConnection 개체 값입니다.

적용 대상