Compartir a través de


SubscriptionClass.SubscriptionFields Property

Gets the collection of fields in the subscription class schema.

Espacio de nombres: Microsoft.SqlServer.Management.Nmo
Ensamblado: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Sintaxis

'Declaración
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

Valor de propiedad

The SubscriptionFieldCollection for the subscription class.

Notas

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 Actualizar una aplicación.

Ejemplo

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

Seguridad para subprocesos

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.

Plataformas

Plataformas de desarrollo

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Plataformas de destino

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Vea también

Referencia

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

Otros recursos

Definir el esquema de suscripción
Schema Element for SubscriptionClass (ADF)