Notification Services—Creating an Event Class

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Articles
Database Articles

Notification Services

© 2006 O'Reilly Media, Inc.

Creating an Event Class

An event class named StockWatchEvents is created in the CreateEventClass( ) method of Example 18-1. The code follows:

private static void CreateEventClass( )
{
  EventClass ec = new EventClass
    (a, "StockWatchEvents");
  EventField ef;
  ef = new EventField(ec, "Symbol");
  ef.Type = "nvarchar(6)";
  ec.EventFields.Add(ef);
  ef = new EventField(ec, "Price");
  ef.Type = "float";
  ec.EventFields.Add(ef);
  a.EventClasses.Add(ec);
  Console.WriteLine
    ("Added event class: " + ec.Name);
}

An event class represents a type of event used by a Notification Services application. The event class has two fields—Symbol of type nvarchar(6) and Price of type float.

The NMO classes for managing event classes, fields, and chronicles are described in Table 18-4.

Table 18-4. NMO classes for managing events

Class Description
EventChronicle Represents an event chronicle.
EventChronicleCollection Represents a collection of event chronicles as EventChronicle objects. The EventChronicles property of the EventClass class returns the event chronicles

for the event class.

EventChronicleRule Represents an event chronicle maintenance query that the generator runs.
EventClass Represents an event class.
EventClassCollection Represents a collection of event classes as EventClass objects. The EventClasses property of the Application class returns the event classes for the Notification

Services application.

EventField Represents a field in an event class schema.
EventFieldCollection Represents a collection of event class schema fields as EventField objects. The EventFields property of the EventClass class returns the event fields for the event class.


Previous_Page_.gif Next_Page_.gif


Personal tools