Class ScopedNotificationPublisher<TNotificationHandler>
Implementation of IScopedNotificationPublisher that publishes notifications within a scope for a specific handler type.
Inheritance
Namespace: Umbraco.Cms.Core.Events
Assembly: Umbraco.Core.dll
Syntax
public class ScopedNotificationPublisher<TNotificationHandler> : IScopedNotificationPublisher where TNotificationHandler : INotificationHandler
Type Parameters
| Name | Description |
|---|---|
| TNotificationHandler | The type of notification handler. |
Constructors
View SourceScopedNotificationPublisher(IEventAggregator, bool)
Initializes a new instance of the ScopedNotificationPublisher<TNotificationHandler> class.
Declaration
public ScopedNotificationPublisher(IEventAggregator eventAggregator, bool publishCancelableNotificationOnScopeExit = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IEventAggregator | eventAggregator | The event aggregator. |
| bool | publishCancelableNotificationOnScopeExit | A value indicating whether cancelable notifications should be published on scope exit. |
Methods
View SourcePublish(INotification)
Publishes a notification to the notification subscribers
Declaration
public void Publish(INotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| INotification | notification |
Remarks
The notification is published upon successful completion of the current scope, i.e. when things have been saved/published/deleted etc.
PublishCancelable(ICancelableNotification)
Publishes a cancelable notification to the notification subscribers
Declaration
public bool PublishCancelable(ICancelableNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| ICancelableNotification | notification |
Returns
| Type | Description |
|---|---|
| bool | True if the notification was cancelled by a subscriber, false otherwise |
PublishCancelableAsync(ICancelableNotification)
Publishes a cancelable notification to the notification subscribers
Declaration
public Task<bool> PublishCancelableAsync(ICancelableNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| ICancelableNotification | notification |
Returns
| Type | Description |
|---|---|
| Task<bool> | True if the notification was cancelled by a subscriber, false otherwise |
PublishScopedNotifications(IList<INotification>)
Publishes all pending scoped notifications.
Declaration
protected virtual void PublishScopedNotifications(IList<INotification> notifications)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<INotification> | notifications | The notifications to publish. |
ScopeExit(bool)
Invokes publishing of all pending notifications within the current scope
Declaration
public void ScopeExit(bool completed)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | completed |
Suppress()
Suppresses all notifications from being added/created until the result object is disposed.
Declaration
public IDisposable Suppress()
Returns
| Type | Description |
|---|---|
| IDisposable |