Class EventAggregator
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
Inheritance
Namespace: Umbraco.Cms.Core.Events
Assembly: Umbraco.Core.dll
Syntax
public class EventAggregator : IEventAggregator
Constructors
View SourceEventAggregator(ServiceFactory)
Initializes a new instance of the EventAggregator class.
Declaration
public EventAggregator(ServiceFactory serviceFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| ServiceFactory | serviceFactory | The service instance factory. |
Methods
View SourcePublishAsync<TNotification>(TNotification, CancellationToken)
Asynchronously send a notification to multiple handlers of both sync and async.
Declaration
public Task PublishAsync<TNotification>(TNotification notification, CancellationToken cancellationToken = default) where TNotification : INotification
Parameters
| Type | Name | Description |
|---|---|---|
| TNotification | notification | The notification object. |
| CancellationToken | cancellationToken | An optional cancellation token. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the publish operation. |
Type Parameters
| Name | Description |
|---|---|
| TNotification | The type of notification being handled. |
PublishAsync<TNotification, TNotificationHandler>(IEnumerable<TNotification>, CancellationToken)
Asynchronously send a notifications to multiple handlers of both sync and async.
Declaration
public Task PublishAsync<TNotification, TNotificationHandler>(IEnumerable<TNotification> notifications, CancellationToken cancellationToken = default) where TNotification : INotification where TNotificationHandler : INotificationHandler
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<TNotification> | notifications | The notification objects. |
| CancellationToken | cancellationToken | An optional cancellation token. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the publish operation. |
Type Parameters
| Name | Description |
|---|---|
| TNotification | The type of notification being handled. |
| TNotificationHandler | The type of the notification handler. |
PublishCancelableAsync<TCancelableNotification>(TCancelableNotification)
Publishes a cancelable notification async to the notification subscribers.
Declaration
public Task<bool> PublishCancelableAsync<TCancelableNotification>(TCancelableNotification notification) where TCancelableNotification : ICancelableNotification
Parameters
| Type | Name | Description |
|---|---|---|
| TCancelableNotification | notification | The notification. |
Returns
| Type | Description |
|---|---|
| Task<bool> |
|
Type Parameters
| Name | Description |
|---|---|
| TCancelableNotification | The type of notification being handled. |
PublishCancelable<TCancelableNotification>(TCancelableNotification)
Publishes a cancelable notification to the notification subscribers.
Declaration
public bool PublishCancelable<TCancelableNotification>(TCancelableNotification notification) where TCancelableNotification : ICancelableNotification
Parameters
| Type | Name | Description |
|---|---|---|
| TCancelableNotification | notification | The notification. |
Returns
| Type | Description |
|---|---|
| bool |
|
Type Parameters
| Name | Description |
|---|---|
| TCancelableNotification | The type of notification being handled. |
Publish<TNotification>(TNotification)
Synchronously send a notification to multiple handlers of both sync and async.
Declaration
public void Publish<TNotification>(TNotification notification) where TNotification : INotification
Parameters
| Type | Name | Description |
|---|---|---|
| TNotification | notification | The notification object. |
Type Parameters
| Name | Description |
|---|---|
| TNotification | The type of notification being handled. |
Publish<TNotification, TNotificationHandler>(IEnumerable<TNotification>)
Synchronously send a notifications to multiple handlers of both sync and async.
Declaration
public void Publish<TNotification, TNotificationHandler>(IEnumerable<TNotification> notifications) where TNotification : INotification where TNotificationHandler : INotificationHandler
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<TNotification> | notifications | The notification objects. |
Type Parameters
| Name | Description |
|---|---|
| TNotification | The type of notification being handled. |
| TNotificationHandler | The type of the notification handler. |