DataWeb
Search Results for

    Show / Hide Table of Contents

    Class AppNotificationService

    Provides services to manage application notifications, such as retrieving and setting notification read status, saving notifications, and removing notifications.

    Inheritance
    object
    AppNotificationService
    Implements
    IAppNotificationService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Notification
    Assembly: DataWeb.Core.dll
    Syntax
    public class AppNotificationService : IAppNotificationService
    Remarks

    Initializes a new instance of the AppNotificationService class.

    Constructors

    AppNotificationService(IAppNotificationStore)

    Provides services to manage application notifications, such as retrieving and setting notification read status, saving notifications, and removing notifications.

    Declaration
    public AppNotificationService(IAppNotificationStore notificationStore)
    Parameters
    Type Name Description
    IAppNotificationStore notificationStore

    An instance of the IAppNotificationStore interface.

    Remarks

    Initializes a new instance of the AppNotificationService class.

    Methods

    GetNotificationAsync(string, CancellationToken)

    Retrieves a notification with the specified notificationId.

    Declaration
    public Task<AppNotification> GetNotificationAsync(string notificationId, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string notificationId

    The Id of the notification to retrieve.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<AppNotification>

    An AppNotification object.

    GetNotificationsAsync(AppNotificationFilter, CancellationToken)

    Retrieves a collection of notifications based on the provided filter.

    Declaration
    public Task<IEnumerable<AppNotification>> GetNotificationsAsync(AppNotificationFilter filter, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AppNotificationFilter filter

    The criteria used to filter notifications.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<AppNotification>>

    A collection of notifications that match the provided filter.

    GetUserNotificationCountAsync(string, string, CancellationToken)

    Retrieves the count of notifications for a user with the specified userIdMaster and context.

    Declaration
    public Task<long> GetUserNotificationCountAsync(string userIdMaster, string context, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string userIdMaster

    The user identifier.

    string context

    The context of the notifications to retrieve.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<long>

    The count of notifications as a long.

    GetUserNotificationViewForcedCountAsync(string, string, CancellationToken)

    Retrieves the count of notifications with forced view for a user with the specified userIdMaster and context.

    Declaration
    public Task<long> GetUserNotificationViewForcedCountAsync(string userIdMaster, string context, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string userIdMaster

    The user identifier.

    string context

    The context of the notifications to retrieve.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<long>

    The count of notifications with forced view as a long.

    GetUserNotificationsAsync(string, string, CancellationToken)

    Retrieves all notifications for a user with the specified userIdMaster and context.

    Declaration
    public Task<IEnumerable<AppNotification>> GetUserNotificationsAsync(string userIdMaster, string context, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string userIdMaster

    The user identifier.

    string context

    The context of the notifications to retrieve.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<AppNotification>>

    A collection of AppNotification objects.

    RemoveNotificationAsync(string, CancellationToken)

    Removes a notification with the specified messageId.

    Declaration
    public Task RemoveNotificationAsync(string notificationId, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string notificationId

    The Id of the notification to remove.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous remove operation.

    RemoveNotificationsToDateAsync(DateTime, string, bool, CancellationToken)

    Removes all notifications with a notification date before or equal to the specified toDate and context.

    Declaration
    public Task RemoveNotificationsToDateAsync(DateTime toDate, string context, bool includeNotRead = false, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    DateTime toDate

    The maximum date for the notifications to remove.

    string context

    The context of the notifications to remove.

    bool includeNotRead

    Whether to include notifications that have not been read. Defaults to false.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous remove operation.

    SaveNotificationAsync(AppNotification, CancellationToken)

    Saves an AppNotification object to the data store.

    Declaration
    public Task SaveNotificationAsync(AppNotification notification, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AppNotification notification

    The AppNotification object to save.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous save operation.

    SetNotificationIsReadAsync(string, bool, CancellationToken)

    Sets the read status of a notification with the specified notificationId.

    Declaration
    public Task SetNotificationIsReadAsync(string notificationId, bool isRead = true, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string notificationId

    The Id of the notification to update.

    bool isRead

    The new read status. Defaults to true.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous update operation.

    SetUserNotificationIsReadAllAsync(string, string, bool, CancellationToken)

    Sets the read status of all notifications for a user with the specified userIdMaster and context.

    Declaration
    public Task SetUserNotificationIsReadAllAsync(string userIdMaster, string context, bool isRead = true, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string userIdMaster

    The user identifier.

    string context

    The context of the notifications to update.

    bool isRead

    The new read status. Defaults to true.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    A task representing the asynchronous update operation.

    Implements

    IAppNotificationService
    In this article
    Back to top Generated by DocFX