Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
I looked in the DLLs and found out :)
public void Initialize(InitializationEngine context)
{
var activityTypeRegistry = ServiceLocator.Current.GetInstance<IActivityTypeRegistry>();
var actionTypeList = new List<ActionType>();
actionTypeList.Add(new ActionType(0, "User created"));
actionTypeList.Add(new ActionType(1, "User updated"));
actionTypeList.Add(new ActionType(2, "User deleted"));
var activityType = new ActivityType("User", actionTypeList);
activityTypeRegistry.Register(activityType);
}
I have made a new Activity type to use for logging changes to Users. So that changes will show up in the Change Log in episerver
This is my new activity:
public class UserActivity : Activity
{
public UserActivity(string activityType, int action) : base(activityType, action)
{
}
public UserActivity(string activityType, int action, IDictionary<string, string> extendedData) : base(activityType, action, extendedData)
{
}
}
public enum UserActivityType
{
Create,
Update,
Delete
}
and here is the code i use when adding an activity
var activityRepository = ServiceLocator.Current.GetInstance<IActivityRepository>();
var data = new Dictionary<string, string>();
data.Add("Username", username);
var activity = new UserActivity("User", (int)UserActivityType.Delete, data);
now an entry will appear in the Change Log, with Category = "User" but the Action is 2.
How do i change the shown action to a string i define instead of the int value?