MemberService Notifications
The MemberService implements IMemberService and provides access to operations involving IMember.
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 |
| 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 |
| 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 |
| Published when MemberService.Delete, and MemberService.DeleteMembersOfType are called in the API.
DeletedEntities: Gets the collection of IMember objects being deleted. |
MemberDeletedNotification |
| 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 |
| Published when MemberService.AssignRoles, and MemberService.ReplaceRoles are called in the API.
|
RemovedMemberRolesNotification |
| Published when MemberService.DissociateRoles are being called in the API.
|
Last modified 1mo ago