Good morning.
I'm using domain events in my project, and the easiest way i found to implement it was by using MediatR. But i don't want my project to directly depend on it, i want apply dependency inversion to hide the library.
Current code that has a dependency in Mediator, because of INotification interface
public class EmailConfirmedEvent : INotification
{
public Guid PassengerId { get; }
public string Email { get; }
public EmailConfirmedEvent(Guid passengerId, string email)
{
Email = email;
PassengerId = passengerId;
}
}
But i want to be like this:
public class EmailConfirmedEvent : IMyProjectDomainEvent
{
public Guid PassengerId { get; }
public string Email { get; }
public EmailConfirmedEvent(Guid passengerId, string email)
{
Email = email;
PassengerId = passengerId;
}
}
By some way i'll need to "convert" from mediator events/event handlers to my project events/event handlers.
What's the best way to do this. Thanks in advance.