Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

EventPublisherExtensions.cs

namespace Nop.Core.Events;

/// 
/// Event publisher extensions
/// 
public static class EventPublisherExtensions
{
    /// 
    /// Entity inserted
    /// 
    /// Entity type
    /// Event publisher
    /// Entity
    /// A task that represents the asynchronous operation
    public static async Task EntityInsertedAsync(this IEventPublisher eventPublisher, T entity) where T : BaseEntity
    {
        await eventPublisher.PublishAsync(new EntityInsertedEvent(entity));
    }

    /// 
    /// Entity inserted
    /// 
    /// Entity type
    /// Event publisher
    /// Entity
    public static void EntityInserted(this IEventPublisher eventPublisher, T entity) where T : BaseEntity
    {
        eventPublisher.Publish(new EntityInsertedEvent(entity));
    }

    /// 
    /// Entity updated
    /// 
    /// Entity type
    /// Event publisher
    /// Entity
    /// A task that represents the asynchronous operation
    public static async Task EntityUpdatedAsync(this IEventPublisher eventPublisher, T entity) where T : BaseEntity
    {
        await eventPublisher.PublishAsync(new EntityUpdatedEvent(entity));
    }

    /// 
    /// Entity updated
    /// 
    /// Entity type
    /// Event publisher
    /// Entity
    public static void EntityUpdated(this IEventPublisher eventPublisher, T entity) where T : BaseEntity
    {
        eventPublisher.Publish(new EntityUpdatedEvent(entity));
    }

    /// 
    /// Entity deleted
    /// 
    /// Entity type
    /// Event publisher
    /// Entity
    /// A task that represents the asynchronous operation
    public static async Task EntityDeletedAsync(this IEventPublisher eventPublisher, T entity) where T : BaseEntity
    {
        await eventPublisher.PublishAsync(new EntityDeletedEvent(entity));
    }

    /// 
    /// Entity deleted
    /// 
    /// Entity type
    /// Event publisher
    /// Entity
    public static void EntityDeleted(this IEventPublisher eventPublisher, T entity) where T : BaseEntity
    {
        eventPublisher.Publish(new EntityDeletedEvent(entity));
    }
}