Base solution for your next web application
Open Closed

How to design a notification system using IEventHandler? #2320


User avatar
0
omar created

I am creating a student management system, I need to be able to send a notification on different platforms, such as SMS, email, website, etc. These notification will be sent based on particular events as listed below: • The teacher posted the grade for an assignment • Student is late or absent • A teacher posted a new assignment

Should I have an event handler for each entity or should I have a “NotificationsEventHandler” that handles all the notification generated by updating or creating entities?

//
public class NotificationsEventHandler : 
    IEventHandler<EntityCreatedEventData<Assignment>>,
    IEventHandler<EntityCreatedEventData<Grade>>, 
   IEventHandler<EntityCreatedEventData<Attendance>>,
		.
		.
		.
{

}

2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If the notification content changes according to entity, it is better to create event handler for each entity, otherwise you can NotificationsEventHandler.

  • User Avatar
    0
    omar created

    Thank you for your help. The content for the notification will be generated by each entity. Each of the following entity will generate a notification.