private static void RunWithArguments(string[] args) { var command = $"{args[0]} {args[1]}"; Console.WriteLine("connecting to Database"); using (var db = new GlossaryDbContext()) { Console.Clear(); switch (command) { case "очистить словарь": db.ClearGlossary(); break; case "создание словаря": db.CreateGlossary(); Console.WriteLine("Done"); break; case "обновление словаря": db.UpdateGlossary(); Console.WriteLine("Done"); break; default: Console.WriteLine("Unknown command"); break; } } }
static void Main(string[] args) { if (args.Length == 2) { RunWithArguments(args); } if (args.Length == 0) { using (var db = new GlossaryDbContext()) { var glossary = db.Words.ToArray(); var line = ReadFromConsole(); while (!string.IsNullOrEmpty(line)) { Console.WriteLine(); AutoComplete(line, glossary); line = ReadFromConsole(); } } } }