The C# EventAttribute Class

EventAttribute is the schema attribute used to register database events on classes, interfaces, fields, or properties. It associates an application-visible event name with an EventType value and makes that event available to runtime handlers such as WaitEvent(), AsyncEvent, and related C# event-listener APIs.

For an overview see page C# Classes

Class Definition

    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface |
                    AttributeTargets.Field | AttributeTargets.Property,
                    AllowMultiple = true)]
    public class EventAttribute : Attribute
    {
        public string Name { get; set; }
        public EventType Type { get; set; }

        public EventAttribute(string name, EventType type);
    }

Member Descriptions

EventAttribute class
Schema attribute that declares a named database event and binds it to a specific EventType.
EventAttribute(string name, EventType type)
Creates an event declaration with the specified event name and trigger type.
Name
Application-visible event name. The name should be unique within the database and is the value passed to event-waiting APIs such as Connection.WaitEvent().
Type
Specifies which kind of database action triggers the event, for example object creation, object deletion, checkpoint completion, or field update.
Scope
The attribute can be applied to a class or interface for object-level events, and to a field or property for field-level update notifications.
Multiple Events
Because AllowMultiple = true, more than one EventAttribute can be attached to the same class when the application needs to react to several event types.
Field Update Events
EventType.OnFieldUpdate is intended for field or property declarations. Other event types are typically declared at the class level.
Typical Usage
Annotate a persistent class with declarations such as [Event("NewEvent", EventType.OnNew)] or annotate a field with [Event("FieldUpdateEvent", EventType.OnFieldUpdate)], then wait for the event by name from a dedicated listener thread or delegate-based event handler.
Related References
See Database Class Enums for EventType values and Using eXtremeDB Database Events and Time-To-Live Features in C# for event-handling workflow and examples.