TransArticle 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
代表交易性出版物中的一篇文章。
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) |