예제 #1
0
        public static async Task RunNewsTweeter(MongoDbCredentials credentials)
        {
            DatabaseFactory databaseFactory = DatabaseFactory.Init(credentials);
            NewsDatabase newsDatabase = NewsDatabase.Init(databaseFactory);

            await RunNewsTweeter();
        }
        public static NewsDatabase Init(DatabaseFactory databaseFactory)
        {
            if (_instance == null)
            {
                lock (_instanceLock)
                {
                    if (_instance == null)
                    {
                        _instance = new NewsDatabase(databaseFactory);
                    }
                }
            }

            return(_instance);
        }
예제 #3
0
 private NewsUpdater()
 {
     this.newsDatabase = NewsDatabase.Instance;
 }
예제 #4
0
 private NewsTweeter()
 {
     this.newsDatabase = NewsDatabase.Instance;
     this.random = new Random();
     this.newsCrawler = new NewsCrawler();
 }