Table of Contents

Class DomainEventsPublisher

Namespace
Silverback.Domain
Assembly
Silverback.Core.Model.dll

Publishes the domain events stored into the domain entities.

public class DomainEventsPublisher
Inheritance
DomainEventsPublisher
Inherited Members

Constructors

DomainEventsPublisher(Func<IEnumerable<object>>, IPublisher)

Initializes a new instance of the DomainEventsPublisher class.

public DomainEventsPublisher(Func<IEnumerable<object>> entitiesProvider, IPublisher publisher)

Parameters

entitiesProvider Func<IEnumerable<object>>

The function returning the modified entities to be scanned for domain events.

publisher IPublisher

The IPublisher to be used to publish the events via the message bus.

DomainEventsPublisher(Func<IEnumerable<object>>, Func<object, IEnumerable<object>?>, Action<object>, IPublisher)

Initializes a new instance of the DomainEventsPublisher class.

public DomainEventsPublisher(Func<IEnumerable<object>> entitiesProvider, Func<object, IEnumerable<object>?> eventsSelector, Action<object> clearEventsAction, IPublisher publisher)

Parameters

entitiesProvider Func<IEnumerable<object>>

The function returning the modified entities to be scanned for domain events.

eventsSelector Func<object, IEnumerable<object>>

The custom delegate to be used to get the events out of the entities being saved.

clearEventsAction Action<object>

The custom delegate to be used to clear the events from the entities after they have been published.

publisher IPublisher

The IPublisher to be used to publish the events via the message bus.

Methods

PublishDomainEvents()

Publishes the domain events stored into the domain entities returned by the provider function.

public void PublishDomainEvents()

PublishDomainEventsAsync()

Publishes the domain events stored into the domain entities returned by the provider function.

public ValueTask PublishDomainEventsAsync()

Returns

ValueTask

A Task representing the asynchronous operation.