Exemple #1
0
        private void PublishMessages()
        {
            var messages = _repository.List(StatusPolicy <RepeatingMessage> .ActiveOnly());

            foreach (var message in messages)
            {
                _dispatcher.Publish(message);
            }
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            var config = InitConfiguration();

            Console.WriteLine($"{DateTime.Now:HH:mm:ss}: Application starting...");

            var options = new DbContextOptionsBuilder <AppDataContext>()
                          .UseInMemoryDatabase(databaseName: "fake-data-db")
                          .Options;

            var efGenericRepo = new EfGenericRepo(new AppDataContext(options));

            new FakeData(efGenericRepo).Initialize();

            var chatClients = GetChatClients(config);

            Console.WriteLine($"{DateTime.Now:HH:mm:ss}: Application started successfully.");

            var commandMessages = efGenericRepo.List(StatusPolicy <SimpleResponseMessage> .ActiveOnly());
            var commandHandler  = new CommandHandler(chatClients, commandMessages);
            var botMain         = new BotMain(chatClients, efGenericRepo, commandHandler);

            WaitForCommands(botMain);
        }