/// <summary> /// Constructor of the EventHubHandler. /// </summary> /// <param name="hubContext"></param> public UpdatesHubHandler(IHubContext <BaseHub <UpdatesHubHandler> > hubContext) { if (instance == null) { instance = this; } this.hubContext = hubContext; // Start to watch database collections to get any changes. Task ingredientsTask = Task.Run(() => MongoManager.Watch <Ingredients>()); Task ingredientPricesTask = Task.Run(() => MongoManager.Watch <IngredientPrices>()); Task recipesTask = Task.Run(() => MongoManager.Watch <Recipes>()); Task weeksTask = Task.Run(() => MongoManager.Watch <Weeks>()); Task weekIngredientsTask = Task.Run(() => MongoManager.Watch <WeekIngredients>()); log.Information("UpdatesHubHandler created."); }