MemberService Events
The MemberService implements IMemberService and provides access to operations involving IMember.
Usage
Example usage of the MemberService events:
using System;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Services.Implement;
namespace Umbraco8.Components
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class SubscribeToSavedEventComposer : ComponentComposer<SubscribeToSavedEventComponent>
{ }
public class SubscribeToSavedEventComponent : IComponent
{
private readonly ILogger _logger;
public SubscribeToSavedEventComponent(ILogger logger)
{
this._logger = logger;
}
public void Initialize()
{
//specify my event handler
MemberService.Saved += MemberService_Saved;
}
private void MemberService_Saved(IMemberService sender, SaveEventArgs<IMember> e)
{
foreach (var member in e.SavedEntities)
{
//write to the logs every time a member is saved
this._logger.Info<MyPublishEventComponent>("member {member} has been saved and event fired!", member.Name);
}
}
public void Terminate()
{
//unsubscribe during shutdown
MemberService.Saved -= MemberService_Saved;
}
}
}
Events
Event | Signature | Description |
---|---|---|
Saving | (IMemberService sender, SaveEventArgs |
Raised 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). "sender" will be the current IMemberService object. "e" will provide:
|
Saved | (IMemberService sender, ContentSavedEventArgs e) |
Raised 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). "sender" will be the current IMemberService object. "e" will provide: NOTE: See here on how to determine if the entity is brand new
|
Publishing | (IPublishingStrategy sender, ContentPublishingEventArgs> e) |
Raised when MemberService.Publishing is called in the API. NOTE: It can be skipped completely if the parameter "raiseEvents" is set to false during the Publish method call (true by default). "sender" will be the current IPublishingStrategy object. "e" will provide: NOTE: If the entity is brand new then HasIdentity will equal false.
|
Published | (IPublishingStrategy sender, ContentPublishedEventArgs e) |
Raised when MemberService.Publish is called in the API and after data has been published. NOTE: It can be skipped completely if the parameter "raiseEvents" is set to false during the Publish method call (true by default). "sender" will be the current IPublishingStrategy object. "e" will provide: NOTE: See here on how to determine if the entity is brand new
|
UnPublishing | (IPublishingStrategy sender, PublishEventArgs<Umbraco.Core.Models.IContent> e) |
Raised when MemberService.UnPublishing is called in the API. "sender" will be the current IPublishingStrategy object. |
UnPublished | (IPublishingStrategy sender, PublishEventArgs<Umbraco.Core.Models.IContent> e) |
Raised when MemberService.UnPublish is called in the API and after data has been published. |
Copying | (IMemberService sender, CopyEventArgs<IContent> e) |
Raised when MemberService.Copy is called in the API. The event is fired after a copy object has been created and had its parentId updated and its state has been set to unpublished. "sender" will be the current IMemberService object. "e" will provide:
|
Copied | (IMemberService sender, CopyEventArgs<IContent> e) |
Raised when MemberService.Copy is called in the API. The event is fired after the content object has been copied. "sender" will be the current IMemberService object. "e" will provide:
|
Moving | (IMemberService sender, MoveEventArgs<IContent> e) |
Raised when MemberService.Move is called in the API. NOTE: If the target parent is the Recycle bin, this event is never fired. Try the Trashing event instead. "sender" will be the current IMemberService object. "e" will provide:
|
Moved | (IMemberService sender, MoveEventArgs<IContent> e) |
Raised when MemberService.Move is called in the API. The event is fired after the content object has been moved. NOTE: If the target parent is the Recycle bin, this event is never fired. Try the Trashed event instead. "sender" will be the current IMemberService object. "e" will provide:
|
Trashing | (IMemberService sender, MoveEventArgs<IContent> e) |
Raised when MemberService.MoveToRecycleBin is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
Trashed | (IMemberService sender, MoveEventArgs<IContent> e) |
Raised when MemberService.MoveToRecycleBin is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
Deleting | (IMemberService sender, DeleteEventArgs<IContent> e) |
Raised when MemberService.DeleteContentOfType, MemberService.Delete, MemberService.EmptyRecycleBin are called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
Deleted | (IMemberService sender, DeleteEventArgs<IContent> e) |
Raised when MemberService.Delete, MemberService.EmptyRecycleBin are called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
DeletingVersions | (IMemberService sender, DeleteRevisionsEventArgs e) |
Raised when MemberService.DeleteVersion, MemberService.DeleteVersions are called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
DeletedVersions | (IMemberService sender, DeleteRevisionsEventArgs e) |
Raised when MemberService.DeleteVersion, MemberService.DeleteVersions are called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
RollingBack | (IMemberService sender, RollbackEventArgs<IContent> e) |
Raised when MemberService.Rollback is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
RolledBack | (IMemberService sender, RollbackEventArgs<IContent> e) |
Raised when MemberService.Rollback is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
SendingToPublish | (IMemberService sender, SendToPublishEventArgs<IContent> e) |
Raised when MemberService.SendToPublication is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
SentToPublish | (IMemberService sender, SendToPublishEventArgs<IContent> e) |
Raised when MemberService.SendToPublication is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
EmptyingRecycleBin | (IMemberService sender, RecycleBinEventArgs e) |
Raised when MemberService.EmptyingRecycleBin is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
EmptiedRecycleBin | (IMemberService sender, RecycleBinEventArgs e) |
Raised when MemberService.EmptiedRecycleBin is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
SavedBlueprint | (IMemberService sender, SaveEventArgs<IContent> e) |
Raised when MemberService.SavedBlueprint is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|
DeletedBlueprint | (IMemberService sender, DeleteEventArgs<IContent> e) |
Raised when MemberService.DeletedBlueprint is called in the API. "sender" will be the current IMemberService object. "e" will provide:
|