SaaS CMS has officially launched! Learn more now.

Class Event

The Event class is used to raise and receive events.

Inheritance
System.Object
Event
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Events.Clients
Assembly: EPiServer.Events.dll
Version: 11.20.7
Syntax
public class Event

Constructors

Event(Guid, IEventBroker, Func<Boolean>)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. This constructor is not intended for public use; Create new Event instances by calling Get(Guid) method.

Declaration
public Event(Guid id, IEventBroker eventBroker, Func<bool> eventsEnabled)
Parameters
Type Name Description
System.Guid id

The id of the event that is instantiated.

IEventBroker eventBroker

Service responsible for sending and receiving events remotely.

System.Func<System.Boolean> eventsEnabled

Delegate that provides information if events are enabled.

Properties

EventsEnabled

True if local event processing is enabled, false otherwise

Declaration
public static bool EventsEnabled { get; set; }
Property Value
Type Description
System.Boolean

Id

Gets the unique id of this event instance.

Declaration
public virtual Guid Id { get; }
Property Value
Type Description
System.Guid

MissedCount

Gets the number of times a raise of this event remotely has been missed.

Declaration
public long MissedCount { get; }
Property Value
Type Description
System.Int64

RaisedCount

Gets the number of times this event has been raised.

Declaration
public long RaisedCount { get; }
Property Value
Type Description
System.Int64

ReceivedCount

Gets the number of times this event has been received from a remote source.

Declaration
public long ReceivedCount { get; }
Property Value
Type Description
System.Int64

RemoteSendBlocked

Gets or sets a value indicating whether this Event is blocked for remote events. That is no remote events will be raised to subscribers.

Declaration
public bool RemoteSendBlocked { get; set; }
Property Value
Type Description
System.Boolean

true if remote events are blocked; otherwise, false.

SentCount

Gets the number of times this event has been received from a remote source.

Declaration
public long SentCount { get; }
Property Value
Type Description
System.Int64

Methods

Get(Guid)

Gets the specified event.

Declaration
public static Event Get(Guid eventId)
Parameters
Type Name Description
System.Guid eventId

An event id of an Event object

Returns
Type Description
Event

The Event object for the eventId specified

GetAll()

Returns all of the Event instances registered

Declaration
public static IEnumerable<Event> GetAll()
Returns
Type Description
System.Collections.Generic.IEnumerable<Event>

A collection of event objects

OnMissed()

Declaration
protected virtual void OnMissed()

OnRaised(EventNotificationEventArgs)

Declaration
protected virtual void OnRaised(EventNotificationEventArgs args)
Parameters
Type Name Description
EventNotificationEventArgs args

OnRaising(EventNotificationEventArgs)

Declaration
protected virtual void OnRaising(EventNotificationEventArgs args)
Parameters
Type Name Description
EventNotificationEventArgs args

Raise(Guid, Object)

Raise this event.

Declaration
public void Raise(Guid raiserId, object param)
Parameters
Type Name Description
System.Guid raiserId

An unique id representing the object that raises the event.

System.Object param

An object that should be send with the event.

Remarks

Note that remote events are dispatched asynchronously.

Raise(Guid, Object, EventRaiseOption)

Raises this event using the raise options specified.

Declaration
public virtual void Raise(Guid raiserId, object param, EventRaiseOption raiseOption)
Parameters
Type Name Description
System.Guid raiserId

An unique id representing the object that raises the event.

System.Object param

An object that should be send with the event.

EventRaiseOption raiseOption

An option indicating whether this event should be broadcasted or just raised on the local site.

Remarks

Note that remote events are dispatched asynchronously.

RaiseAsync(Guid, Object, EventRaiseOption)

Raises this event asynchronously using the raise options specified.

Declaration
public virtual Task RaiseAsync(Guid raiserId, object param, EventRaiseOption raiseOption)
Parameters
Type Name Description
System.Guid raiserId

An unique id representing the object that raises the event.

System.Object param

An object that should be send with the event.

EventRaiseOption raiseOption

An option indicating whether this event should be broadcasted or just raised on the local site.

Returns
Type Description
System.Threading.Tasks.Task

A Task object that allows for synchronisation of this event.

Events

Missed

Occurs when a remote message about this event was missed.

Declaration
public event EventHandler Missed
Event Type
Type Description
System.EventHandler

Raised

Occurs when this event is raised.

Declaration
public event EventNotificationHandler Raised
Event Type
Type Description
EventNotificationHandler

Raising

Occurs when this event is about to be raised.

Declaration
public event EventNotificationHandler Raising
Event Type
Type Description
EventNotificationHandler

Extension Methods