Interface INotificationsRepository
Represents a repository for Notification entities.
Namespace: Umbraco.Cms.Core.Persistence.Repositories
Assembly: Umbraco.Core.dll
Syntax
public interface INotificationsRepository : IRepository
Methods
View SourceDeleteNotifications(IEntity)
Deletes all notifications for an entity.
Declaration
int DeleteNotifications(IEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| IEntity | entity | The entity whose notifications should be deleted. |
Returns
| Type | Description |
|---|---|
| int | The number of notifications deleted. |
DeleteNotifications(IUser)
Deletes all notifications for a user.
Declaration
int DeleteNotifications(IUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user whose notifications should be deleted. |
Returns
| Type | Description |
|---|---|
| int | The number of notifications deleted. |
DeleteNotifications(IUser, IEntity)
Deletes all notifications for a specific user and entity combination.
Declaration
int DeleteNotifications(IUser user, IEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user. |
| IEntity | entity | The entity. |
Returns
| Type | Description |
|---|---|
| int | The number of notifications deleted. |
GetEntityNotifications(IEntity)
Gets all notifications for an entity.
Declaration
IEnumerable<Notification> GetEntityNotifications(IEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| IEntity | entity | The entity to get notifications for. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Notification> | A collection of notifications. |
GetUserNotifications(IUser)
Gets all notifications for a user.
Declaration
IEnumerable<Notification> GetUserNotifications(IUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to get notifications for. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Notification> | A collection of notifications. |
GetUsersNotifications(IEnumerable<int>, string?, IEnumerable<int>, Guid)
Gets notifications for multiple users, filtered by action, node IDs, and object type.
Declaration
IEnumerable<Notification> GetUsersNotifications(IEnumerable<int> userIds, string? action, IEnumerable<int> nodeIds, Guid objectType)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<int> | userIds | The user identifiers. |
| string | action | The action to filter by, or |
| IEnumerable<int> | nodeIds | The node identifiers to filter by. |
| Guid | objectType | The object type to filter by. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Notification> | A collection of notifications. |
SetNotifications(IUser, IEntity, string[])
Sets the notifications for a user and entity, replacing any existing notifications.
Declaration
IEnumerable<Notification> SetNotifications(IUser user, IEntity entity, string[] actions)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user. |
| IEntity | entity | The entity. |
| string[] | actions | The actions to set notifications for. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Notification> | A collection of the created notifications. |
TryCreateNotification(IUser, IEntity, string, out Notification?)
Tries to create a notification for a user and entity.
Declaration
bool TryCreateNotification(IUser user, IEntity entity, string action, out Notification? notification)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to create the notification for. |
| IEntity | entity | The entity related to the notification. |
| string | action | The action that triggered the notification. |
| Notification | notification | When successful, contains the created notification. |
Returns
| Type | Description |
|---|---|
| bool |
|