Umbraco CMS
10.latest (LTS)
Ask or search…
K
Links

MemberService Notifications

The MemberService implements IMemberService and provides access to operations involving IMember.

Usage

using Microsoft.Extensions.Logging;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Services.Notifications;
namespace MySite
{
public class MemberNotificationHandler : INotificationHandler<MemberSavedNotification>
{
private readonly ILogger<MemberNotificationHandler> _logger;
public MemberNotificationHandler(ILogger<MemberNotificationHandler> logger)
{
_logger = logger;
}
public void Handle(MemberSavedNotification notification)
{
foreach (var member in notification.SavedEntities)
{
// Write to the logs every time a member is saved.
_logger.LogInformation("Member {member} has been saved and notification published!", member.Name);
}
}
}
}
Notification
Members
Description
MemberSavingNotification
  • IEnumerable<IMember> SavedEntities
  • EventMessages Messages
  • IDictionary<string,object> State
  • bool Cancel
Published when MemberService.Saving is called in the API. NOTE: It can be skipped completely if the parameter "raiseEvents" is set to false during the Save method call (true by default). SavedEntities: Gets the collection of IMember objects being saved.
MemberSavedNotification
  • IEnumerable<IMember> SavedEntities
  • EventMessages Messages
  • IDictionary<string,object> State
Published when MemberService.Save is called in the API and after data has been persisted. NOTE: It can be skipped completely if the parameter "raiseEvents" is set to false during the Save method call (true by default). NOTE: See here on how to determine if the entity is brand new SavedEntities: Gets the saved collection of IMember objects.
MemberDeletingNotification
  • IEnumerable<IMember> DeletedEntities
  • EventMessages Messages
  • IDictionary<string,object> State
  • bool Cancel
Published when MemberService.Delete, and MemberService.DeleteMembersOfType are called in the API. DeletedEntities: Gets the collection of IMember objects being deleted.
MemberDeletedNotification
  • IEnumerable<IMember> DeletedEntities
  • EventMessages Messages
  • IDictionary<string,object> State
Published when MemberService.Delete, and MemberService.DeleteMembersOfType are called in the API, after the members has been deleted. DeletedEntities: Gets the collection of deleted IMember objects.
AssignedMemberRolesNotification
  • string[] Roles
  • int[] MemberIds
Published when MemberService.AssignRoles, and MemberService.ReplaceRoles are called in the API.
  1. 1.
    Roles: Collection of role names being assigned.
  2. 2.
    MemberIds: Collection of Ids of the members the roles are being assigned to.
RemovedMemberRolesNotification
  • string[] Roles
  • int[] MemberIds
Published when MemberService.DissociateRoles are being called in the API.
  1. 1.
    Roles: Collection of role names being removed.
  2. 2.
    MemberIds: Collection of Ids of the members the roles are being removed from.