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.
Платформы
Платформы разработки
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
Целевые платформы
Список поддерживаемых платформ см. в разделе Hardware and Software Requirements for Installing SQL Server 2005.
См. также
Справочник
SubscriptionClass Class
SubscriptionClass Members
Microsoft.SqlServer.Management.Nmo Namespace
SubscriptionClass.SubscriptionConditionEventRules Property
Другие ресурсы
Определение схемы подписок
Schema Element for SubscriptionClass (ADF)