EventField Class
Represents a field in the event class schema.
Пространство имен: Microsoft.SqlServer.Management.Nmo
Сборка: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
Синтаксис
'Декларация
Public NotInheritable Class EventField
Inherits NamedSmoObject
public sealed class EventField : NamedSmoObject
public ref class EventField sealed : public NamedSmoObject
public final class EventField extends NamedSmoObject
public final class EventField extends NamedSmoObject
Замечания
For each event class, you must define the event class schema. To define the schema, you define the individual fields. These fields are used to create the event class view and the underlying table.
When you define an event field, you define the field name, data type, and optional modifiers.
If you add or delete event fields, updating the application deletes and re-creates the event class. This includes dropping and re-creating the tables and indexes used by this event class. Any data existing in the original event class tables is permanently deleted.
Inheritance Hierarchy
System.Object
Microsoft.SqlServer.Management.Smo.SmoObjectBase
Microsoft.SqlServer.Management.Smo.SqlSmoObject
Microsoft.SqlServer.Management.Smo.NamedSmoObject
Microsoft.SqlServer.Management.Nmo.EventField
Пример
The following examples show how to define an event field that cannot be null and then add it 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 define an event field and then add it 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 define an event field and then add it 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)
Синхронизация потоков
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.
См. также
Справочник
EventField Members
Microsoft.SqlServer.Management.Nmo Namespace
Другие ресурсы
Определение свойств основного класса событий
Schema Element for EventClass (ADF)