Show / Hide Table of Contents

Class NotificationService

Implements a simple notification service.

Inheritance
System.Object
NotificationService
NotificationBase<TMessage>
Implements
INotificationService
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.Notification
Assembly: Sartorius.SAF.dll
Syntax
[Export(typeof(INotificationService))]
public class NotificationService : INotificationService

Methods

View Source

DoPublish<T>(T)

Publishes the notification to all subscribers.

Declaration
protected virtual void DoPublish<T>(T notification)
Parameters
Type Name Description
T notification

The arguments that are passed to the subscribers.

Type Parameters
Name Description
T
View Source

DoSubscribe<T>(Action<T>, Boolean, Predicate<T>)

Subscribes a delegate to an event.

Declaration
protected virtual SubscriptionToken DoSubscribe<T>(Action<T> action, bool keepSubscriberReferenceAlive, Predicate<T> filter)
Parameters
Type Name Description
System.Action<T> action

The delegate that gets executed when the payload is published.

System.Boolean keepSubscriberReferenceAlive

When true, the CompositePresentationEvent keeps a reference to the subscriber so it does not get garbage collected.

System.Predicate<T> filter

Filter to evaluate if the subscriber should receive the event.

Returns
Type Description
SubscriptionToken

A SubscriptionToken that uniquely identifies the added subscription.

Type Parameters
Name Description
T
View Source

DoUnsubscribe(SubscriptionToken)

Removes the subscriber matching the SubscriptionToken.

Declaration
protected virtual void DoUnsubscribe(SubscriptionToken subscriptionToken)
Parameters
Type Name Description
SubscriptionToken subscriptionToken

The SubscriptionToken.

Explicit Interface Implementations

View Source

INotificationService.Publish<T>(T)

Publishes the specific notification.

Declaration
void INotificationService.Publish<T>(T notification)
Parameters
Type Name Description
T notification

The payload.

Type Parameters
Name Description
T

The notification type.

View Source

INotificationService.Subscribe<T>(Action<T>)

Subscribes the action to the notifications of T.

Declaration
SubscriptionToken INotificationService.Subscribe<T>(Action<T> action)
Parameters
Type Name Description
System.Action<T> action

The System.Action<T> that is invoked when the notification is published.

Returns
Type Description
SubscriptionToken

A SubscriptionToken.

Type Parameters
Name Description
T

The notification type.

View Source

INotificationService.Subscribe<T>(Action<T>, Predicate<T>)

Subscribes the action with the given filter to the notifications of T.

Declaration
SubscriptionToken INotificationService.Subscribe<T>(Action<T> action, Predicate<T> filter)
Parameters
Type Name Description
System.Action<T> action

The System.Action<T> that is invoked when the notification is published.

System.Predicate<T> filter

The filter System.Predicate<T> that defines whether the notification is published to the subscriber.

Returns
Type Description
SubscriptionToken

A SubscriptionToken.

Type Parameters
Name Description
T

The payload type.

View Source

INotificationService.Unsubscribe(SubscriptionToken)

Removes the subscriber matching the SubscriptionToken.

Declaration
void INotificationService.Unsubscribe(SubscriptionToken subscriptionToken)
Parameters
Type Name Description
SubscriptionToken subscriptionToken

The SubscriptionToken.

Implements

INotificationService

Extension Methods

CollectionExtensions.AddRange<T, TCollection>(TCollection, IEnumerable<T>)
SerializableObjectCloneExtension.Clone<T>(T)
  • View Source
Back to top Generated by DocFX