Skip to content

Instantly share code, notes, and snippets.

@alasvant
Created July 6, 2020 16:35
Show Gist options
  • Save alasvant/5c7c5e2fcd9cdd044b365a6fc40bc7f9 to your computer and use it in GitHub Desktop.
Save alasvant/5c7c5e2fcd9cdd044b365a6fc40bc7f9 to your computer and use it in GitHub Desktop.
Sample code for custom Episerver activity.
using System.Collections.Generic;
using EPiServer.DataAbstraction.Activities;
namespace EpiAuditLogging.Web.Features.AuditLogging
{
public class ContentSecurityActivity : Activity
{
/// <summary>
/// Name of this activity (used for example to register this activity).
/// </summary>
public const string ActivityTypeName = "ContentSecurity";
/// <summary>
/// Creates a new instance using the given action type.
/// </summary>
/// <param name="action">What kind of action was done, <see cref="ContentSecurityActionType"/>.</param>
public ContentSecurityActivity(ContentSecurityActionType action) : base(ActivityTypeName, (int)action, new Dictionary<string, string>(0)) { }
/// <summary>
/// Creates a new instance using the action type and dictionary containing the data that will be logged.
/// </summary>
/// <param name="action">What kind of action was done, <see cref="ContentSecurityActionType"/>.</param>
/// <param name="extendedData">The data in dictionary that will be logged to the activity log.</param>
public ContentSecurityActivity(ContentSecurityActionType action, IDictionary<string, string> extendedData) : base(ActivityTypeName, (int)action, extendedData) { }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment