Exemplo n.º 1
0
        public CategoryWatcherHelperService(
            ILinkerService linkerService,
            IUrlShorteningService urlShorteningService,
            ISession session,
            ILogger logger,
            ICommandParser commandParser,
            IMediaWikiApiHelper apiHelper,
            IResponder responder)
        {
            this.linkerService        = linkerService;
            this.urlShorteningService = urlShorteningService;
            this.session   = session;
            this.logger    = logger;
            this.apiHelper = apiHelper;
            this.responder = responder;

            lock (this.session)
            {
                this.watchedCategories = this.session.CreateCriteria <WatchedCategory>().List <WatchedCategory>();

                this.ignoredPages = this.session.CreateCriteria <IgnoredPage>()
                                    .List <IgnoredPage>()
                                    .Select(x => x.Title)
                                    .ToList();
            }

            logger.DebugFormat("Registering CategoryWatcher keys in CommandParser");
            foreach (var category in this.watchedCategories)
            {
                commandParser.RegisterCommand(category.Keyword, typeof(ForceUpdateCommand));
            }
        }