Show / Hide Table of Contents

    Class DomainEventsPublisher

    Publishes the domain events stored into the domain entities.

    Inheritance
    object
    DomainEventsPublisher
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Silverback.Domain
    Assembly: Silverback.Core.Model.dll
    Syntax
    public class DomainEventsPublisher

    Constructors

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

    Initializes a new instance of the DomainEventsPublisher class.

    Declaration
    public DomainEventsPublisher(Func<IEnumerable<object>> entitiesProvider, IPublisher publisher)
    Parameters
    Type Name Description
    Func<IEnumerable<object>> entitiesProvider

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

    IPublisher publisher

    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.

    Declaration
    public DomainEventsPublisher(Func<IEnumerable<object>> entitiesProvider, Func<object, IEnumerable<object>?> eventsSelector, Action<object> clearEventsAction, IPublisher publisher)
    Parameters
    Type Name Description
    Func<IEnumerable<object>> entitiesProvider

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

    Func<object, IEnumerable<object>> eventsSelector

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

    Action<object> clearEventsAction

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

    IPublisher publisher

    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.

    Declaration
    public void PublishDomainEvents()

    PublishDomainEventsAsync()

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

    Declaration
    public ValueTask PublishDomainEventsAsync()
    Returns
    Type Description
    ValueTask

    A Task representing the asynchronous operation.

    GitHub E-Mail
    ↑ Back to top © 2026 Sergio Aquilini