SubscriptionClass.SubscriptionFields Property

Gets the collection of fields in the subscription class schema.

命名空间: Microsoft.SqlServer.Management.Nmo
程序集: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

语法

声明
Public ReadOnly Property SubscriptionFields As SubscriptionFieldCollection
public SubscriptionFieldCollection SubscriptionFields { get; }
public:
property SubscriptionFieldCollection^ SubscriptionFields {
    SubscriptionFieldCollection^ get ();
}
/** @property */
public SubscriptionFieldCollection get_SubscriptionFields ()
public function get SubscriptionFields () : SubscriptionFieldCollection

属性值

The SubscriptionFieldCollection for the subscription class.

备注

For applications in which users can provide subscription parameter values, such as a city name for weather subscriptions, you must specify the subscription fields for storing this data.

Define individual subscription fields using the SubscriptionField class.

Notification Services automatically adds SubscriberID, Created, Updated, and Enabled fields to the subscription class schema.

If you add or delete fields, updating the application re-creates the subscription class to which it corresponds. Notification Services renames the existing subscription tables by appending Old to the table name and then creates new tables. Existing subscription table indexes are left unchanged.

If you want to transfer data between the old and new subscription tables, it must be done manually. For more information, see 更新应用程序.

示例

The following examples show how to define and add a subscription field to the end of the collection of fields for a subscription class:

// Define a DeviceName field that cannot be NULL
// Add the field to the end of the field collection
SubscriptionField subDevice = 
    new SubscriptionField(flightSubscriptions, "DeviceName");
subDevice.Type = "nvarchar(255)";
subDevice.TypeModifier = "not null";
flightSubscriptions.SubscriptionFields.Add(subDevice);
' Define a DeviceName field that cannot be NULL
' Add the field to the end of the field collection
Dim subDevice As SubscriptionField = _
    New SubscriptionField(flightSubscriptions, "DeviceName")
subDevice.Type = "nvarchar(255)"
subDevice.TypeModifier = "not null"
flightSubscriptions.SubscriptionFields.Add(subDevice)

The following examples show how to define and add a subscription field at the second position in the collection of fields for a subscription class:

// Add a GoingTo field and add it at position 2
SubscriptionField subDestination = 
    new SubscriptionField(flightSubscriptions, "GoingTo");
subDestination.Type = "nvarchar(6)";
flightSubscriptions.SubscriptionFields.Add(subDestination, 2);
' Add a GoingTo field and add it at position 2
Dim subDestination As SubscriptionField = _
    New SubscriptionField(flightSubscriptions, "GoingTo")
subDestination.Type = "nvarchar(6)"
flightSubscriptions.SubscriptionFields.Add(subDestination, 2)

The following examples show how to define and add a subscription field before the GoingTo field in the subscription class schema:

// Define a LeavingFrom field and add it before the GoingTo field
SubscriptionField subOrgin = 
    new SubscriptionField(flightSubscriptions, "LeavingFrom");
subOrgin.Type = "nvarchar(6)";
flightSubscriptions.SubscriptionFields.Add(subOrgin, "GoingTo");
' Define a LeavingFrom field and add it before the GoingTo field
Dim subOrgin As SubscriptionField = _
    New SubscriptionField(flightSubscriptions, "LeavingFrom")
subOrgin.Type = "nvarchar(6)"
flightSubscriptions.SubscriptionFields.Add(subOrgin, "GoingTo")

线程安全

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

平台

开发平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

目标平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

请参阅

参考

SubscriptionClass Class
SubscriptionClass Members
Microsoft.SqlServer.Management.Nmo Namespace
SubscriptionClass.SubscriptionConditionEventRules Property

其他资源

定义订阅架构
Schema Element for SubscriptionClass (ADF)