EventClass.EventFields Property

Gets the EventFieldCollection for the EventClass.

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

Sintaxis

'Declaración
Public ReadOnly Property EventFields As EventFieldCollection
public EventFieldCollection EventFields { get; }
public:
property EventFieldCollection^ EventFields {
    EventFieldCollection^ get ();
}
/** @property */
public EventFieldCollection get_EventFields ()
public function get EventFields () : EventFieldCollection

Valor de propiedad

The EventFieldCollection object for the event class.

Notas

You must define event fields for each event class.

The EventFieldCollection object collection contains the event fields that define the schema for the event class. You can add fields to the schema by using the collection's Add method.

Ejemplo

The following examples show how to add an event field to the end of the collection of event fields:

// Add an orgin field to the end of the field collection
EventField eventOrgin = 
    new EventField(flightEvents, "LeavingFrom");
eventOrgin.Type = "nvarchar(6)";
eventOrgin.TypeModifier = "not null";
flightEvents.EventFields.Add(eventOrgin);
' Add an orgin field to the end of the field collection.
Dim eventOrgin As EventField = _
    New EventField(flightEvents, "LeavingFrom")
eventOrgin.Type = "nvarchar(6)"
eventOrgin.TypeModifier = "not null"
flightEvents.EventFields.Add(eventOrgin)

The following examples show how to add an event field to an event class before a specific event field:

// Define a destination field and add it before the Price field
EventField eventDestination = 
    new EventField(flightEvents, "GoingTo");
eventDestination.Type = "nvarchar(6)";
flightEvents.EventFields.Add(eventDestination, "Price");
' Define a destination field and add it before the Price field.
Dim eventDestination As EventField = _
    New EventField(flightEvents, "GoingTo")
eventDestination.Type = "nvarchar(6)"
flightEvents.EventFields.Add(eventDestination, "Price")

The following examples show how to add an event field to an event class at a specific position:

// Define a price field and add it at position 1
EventField eventPrice = new EventField(flightEvents, "Price");
eventPrice.Type = "float";
flightEvents.EventFields.Add(eventPrice, 1);
' Define a price field and add it at position 1.
Dim eventPrice As EventField = _
    New EventField(flightEvents, "Price")
eventPrice.Type = "float"
flightEvents.EventFields.Add(eventPrice, 1)

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

EventClass Class
EventClass Members
Microsoft.SqlServer.Management.Nmo Namespace

Otros recursos

Definir clases de eventos
Schema Element for EventClass (ADF)