Show / Hide Table of Contents

    Class MessagesSource<TBaseEvent>

    The default generic implementation of IMessagesSource. It contains some protected methods to add the internal events to a temporary collection exposed via the IMessagesSource implementation.

    Inheritance
    object
    MessagesSource<TBaseEvent>
    DomainEntity
    EventSourcingDomainEntity<TKey, TDomainEvent>
    EventStoreEntity<TEventEntity>
    Implements
    IMessagesSource
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Silverback.Messaging.Messages
    Assembly: Silverback.Core.dll
    Syntax
    public abstract class MessagesSource<TBaseEvent> : IMessagesSource
    Type Parameters
    Name Description
    TBaseEvent

    The base type of the events being published.

    Remarks

    This is the base class of the DomainEntity defined in Silverback.Core.Model.

    Methods

    | Improve this doc View source

    AddEvent(TBaseEvent)

    Adds the specified event to the collection of events related to this object.

    In the case of an entity model the event will be published when the entity is saved to the underlying database.

    Declaration
    protected virtual void AddEvent(TBaseEvent @event)
    Parameters
    Type Name Description
    TBaseEvent event

    The instance of TBaseEvent to be added.

    Remarks

    This is the base class of the DomainEntity defined in Silverback.Core.Model.

    | Improve this doc View source

    AddEvent<TEvent>(bool)

    Adds a new instance of TEvent to the collection of events related to this object.

    In the case of an entity model the event will be published when the entity is saved to the underlying database.

    Declaration
    protected TEvent AddEvent<TEvent>(bool allowMultiple = true) where TEvent : TBaseEvent, new()
    Parameters
    Type Name Description
    bool allowMultiple

    if set to false only one instance of the specified type TEvent will be added.

    Returns
    Type Description
    TEvent

    The TEvent instance that was added.

    Type Parameters
    Name Description
    TEvent

    The type of the event.

    Remarks

    This is the base class of the DomainEntity defined in Silverback.Core.Model.

    | Improve this doc View source

    ClearMessages()

    Called after the messages have been successfully published (and processed) to clear the messages collection.

    Declaration
    public void ClearMessages()
    Remarks

    This is the base class of the DomainEntity defined in Silverback.Core.Model.

    | Improve this doc View source

    GetMessages()

    Gets the messages to be published.

    Declaration
    public IEnumerable<object>? GetMessages()
    Returns
    Type Description
    IEnumerable<object>

    The message objects.

    Remarks

    This is the base class of the DomainEntity defined in Silverback.Core.Model.

    | Improve this doc View source

    RemoveEvent(TBaseEvent)

    Removes the specified event from the collection of events related to this object.

    Declaration
    protected void RemoveEvent(TBaseEvent @event)
    Parameters
    Type Name Description
    TBaseEvent event

    The TBaseEvent to be removed.

    Remarks

    This is used only to withdraw an event that wasn't published yet.

    Implements

    IMessagesSource
    • Improve this doc
    • View source
    GitHub E-Mail
    ↑ Back to top © 2020 Sergio Aquilini