Condividi tramite


SubscriptionClass.SubscriptionFields Property

Gets the collection of fields in the subscription class schema.

Spazio dei nomi: Microsoft.SqlServer.Management.Nmo
Assembly : Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Sintassi

'Dichiarazione
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

Valore proprietà

The SubscriptionFieldCollection for the subscription class.

Osservazioni

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 Aggiornamento di un'applicazione.

Esempio

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")

Thread Safety

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.

Piattaforme

Piattaforme di sviluppo

Per un elenco delle piattaforme supportate, vedere Requisiti hardware e software per l'Installazione di SQL Server 2005.

Piattaforme di destinazione

Per un elenco delle piattaforme supportate, vedere Requisiti hardware e software per l'Installazione di SQL Server 2005.

Vedere anche

Riferimento

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

Altre risorse

Definizione dello schema di sottoscrizione
Schema Element for SubscriptionClass (ADF)