语言

TransArticle 类

定义

代表交易性出版物中的一篇文章。

public ref class TransArticle sealed : Microsoft::SqlServer::Replication::Article
public sealed class TransArticle : Microsoft.SqlServer.Replication.Article
type TransArticle = class
    inherit Article
Public NotInheritable Class TransArticle
Inherits Article
继承

示例

// 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

注解

线程安全性

任何此类公共静态(SharedMicrosoft Visual Basic)成员对多线程操作都是安全的。 不能保证任何实例成员是线程安全的。

构造函数

名称 说明
TransArticle()

创建类的新实例 TransArticle

TransArticle(String, String, String, ServerConnection)

创建一个新的类实例TransArticle,具有所需的属性,并与 Microsoft SQL Server 实例有指定的连接。

属性

名称 说明
ArticleId

获取文章ID值。

(继承自 Article)
ArticleLogTablespace

获取或设置用于存储复制日志信息的 Oracle 表空间名称。

CachePropertyChanges

获取或设置是缓存复制属性的更改,还是立即应用。

(继承自 ReplicationObject)
CommandFormat

获取或设定条目中变更如何传播。

ConnectionContext

获取或设置连接到 Microsoft SQL Server 实例。

(继承自 ReplicationObject)
CreateArticleAsHeterogeneous

获取或设置一个值,指示是否创建异构条目。

(继承自 Article)
CreationScript

获取或设置用于在订阅者创建目标对象的 Transact-SQL 脚本文件的名称和完整路径。

(继承自 Article)
DatabaseName

获取或设置包含文章中数据和对象的数据库名称。

(继承自 Article)
DatatypeMappingOptions

返回非 SQL Server Publisher 是否使用默认文章数据类型映射。

DeleteCommand

获取或设置用于复制删除的命令。

Description

获取或设置文章的文本描述。

(继承自 Article)
DestinationObjectName

在订阅者处获取或设置文章的源数据库对象。

(继承自 Article)
DestinationObjectOwner

在订阅者处获取或设置文章源数据库对象的模式所有者。

(继承自 Article)
FilterClause

获取或设置用于横向过滤文章的 WHERE 子句。

FilterProcName

获取或设置用于横向过滤表的存储过程(用复制创建的)。

FilterProcOwner

获取或设置拥有用于横向划分基于表文章的存储过程的数据库用户。

IdentityRangeManagementOption

获取或设置文章的身份范围管理选项。

(继承自 Article)
IdentityRangeThreshold

获取或设定将新范围的身份列值分配给Publisher或Subscriber的值。

(继承自 Article)
InsertCommand

获取或设置用于复制插入的命令。

IsExistingObject

判断该对象是否存在于服务器上。

(继承自 ReplicationObject)
Name

获取或设定文章名称。

(继承自 Article)
PreCreationMethod

当发布对象已存在订阅数据库时,获取或设置要执行的动作。

(继承自 Article)
PublicationName

获取或确定文章所属出版物的名称。

(继承自 Article)
PublisherIdentityRangeSize

获取或设置分配给表列的身份值范围,在 Publisher 上。

(继承自 Article)
PublisherName

获取或设定发表文章的非 SQL Server Publisher 名称。

SchemaOption

获取或设置文章的模式创建选项。

(继承自 Article)
SnapshotObjectName

获取或设置提供文章初始数据快照的数据库对象。

SnapshotObjectOwner

获取或设置提供文章初始数据快照的数据库对象的所有者。

SourceObjectName

获取或设置正在发布的数据库对象的名称。

(继承自 Article)
SourceObjectOwner

获取或设置正在发布的数据库对象的所有者。

(继承自 Article)
SqlServerName

获取该对象所连接的 Microsoft SQL Server 实例名称。

(继承自 ReplicationObject)
SubscriberIdentityRangeSize

在必须分配另一个身份范围之前,获取或设置在订阅者表中身份列中可插入的最大新行数。

(继承自 Article)
Type

获取或确定文章类型。

(继承自 Article)
UpdateCommand

获取或设置用于复制更新的命令。

UserData

获取或设置一个对象属性,允许用户将自己的数据附加到该对象上。

(继承自 ReplicationObject)
VerticalPartition

获得一个值,表示所有列是否都已发布在表格文章中。

(继承自 Article)

方法

名称 说明
AddReplicatedColumns(Array)

包含垂直划分表格文章中的列。

CheckValidCreation()

检查有效的条目创建。

(继承自 Article)
CheckValidDefinition(Boolean)

表示该定义是否有效。

(继承自 Article)
CommitPropertyChanges()

将所有缓存的属性更改语句发送到Microsoft SQL Server实例。

(继承自 ReplicationObject)
Create()

基于当前连接的SQL Server实例,基于当前对象或对象TransArticleMergeArticle属性创建新条目。

(继承自 Article)
Decouple()

将被引用的复制对象与服务器解耦。

(继承自 ReplicationObject)
EnumHeterogeneousColumns()

返回非SQL Server Publisher发表的表格文章的列信息。

GetChangeCommand(StringBuilder, String, String)

返回复制中的更改命令。

(继承自 ReplicationObject)
GetCreateCommand(StringBuilder, Boolean, ScriptOptions)

返回复制中的create命令。

(继承自 ReplicationObject)
GetDropCommand(StringBuilder, Boolean)

返回复制中的drop命令。

(继承自 ReplicationObject)
InternalRefresh(Boolean)

从复制中启动内部刷新。

(继承自 ReplicationObject)
ListReplicatedColumns()

返回表格文章中已发布的列。

Load()

从服务器加载现有对象的属性。

(继承自 ReplicationObject)
LoadProperties()

从服务器加载现有对象的属性。

(继承自 ReplicationObject)
Refresh()

重新加载对象的属性。

(继承自 ReplicationObject)
Remove()

根据当前对象或TransArticle对象的MergeArticle当前属性,删除当前连接的SQL Server实例的现有文章。

(继承自 Article)
RemoveReplicatedColumns(Array)

排除垂直划分表格条目的列。

Script(ScriptOptions)

生成一个 Transact-SQL 脚本,可用于创建或删除 TransArticle 服务器上的对象 MergeArticle 或对象。

(继承自 Article)
ScriptChangeColumnDestinationDataType(String, String, Int64, Int32, Int64, ScriptOptions)

返回一个用于更改非SQL Server Publisher列数据类型映射的 Transact-SQL 脚本。

SetColumnDestinationDataType(String, String, Int64, Int32, Int64)

为非 SQL Server Publisher 设置列数据类型映射。

适用于

另请参阅