EpiEvents - a library for simpler Episerver event handling

A few months ago I wrote an article about better event handling. Now I have created and published a library which allows you to handle Episerver events in this way easier.

Install the library from the Episerver NuGet Feed:

Install-Package EpiEvents.Core

The library uses MediatR for event publishing and handling. You have to configure it in the StructureMap config.

Scan(x =>
For<SingleInstanceFactory>().Use<SingleInstanceFactory>(ctx => t => ctx.GetInstance(t));
For<MultiInstanceFactory>().Use<MultiInstanceFactory>(ctx => t => ctx.GetAllInstances(t));

You also have to configure default settings for the EpiEvents.


Default settings disable all loading events. Loading events cause Episerver to slow down. But you can enable those events in the appSettings.

<add key="EpiEvents:EnableLoadingEvents" value="true" />

Handling of an event is simple. Create MediatR's INotificationHandler with a type parameter of the event you want to handle.

public class SampleHandler : INotificationHandler<CreatedContent>
    public void Handle(CreatedContent notification)
        // Handle your event

For more information see the GitHub page.