Find the package on NuGet: https://www.nuget.org/packages/i2vNotificationLibrary
Find the package on Github: https://github.com/Architrixs/NotificationLibrary
public class NotificationHub : Hub
{
// Hub implementation
}Register the library services, such as NotificationLibrary and NotificationSender, as singleton services in your application's dependency injection container:
services.AddSingleton<NotificationLibrary>();
services.AddSingleton<NotificationSender>();In your NotificationHub constructor, set up the IHubContext and initialize your library:
public NotificationHub(IHubContext<NotificationHub> hub, NotificationLibrary notificationLibrary)
{
notificationHub = hub;
notificationLibrary.SetHubContext(notificationHub);
// Register your entities
notificationLibrary.RegisterEntity<VideoSource>("VideoSource");
notificationLibrary.RegisterEntity<AnalyticServer>("AnalyticServer");
notificationLibrary.RegisterEntity<User>("User");
}You can inject the NotificationLibrary in a controller and call its Method like so:
_notificationLibrary.SendNotificationToAll("crudNotification", OperationType.Update, videoSource, message);