public static void Populate(TableOperator tableOperator, string filePath) { PunFile punFile = new PunFile(filePath); IEnumerable <StarWarsPun> puns = punFile.GetPuns(); Task.Run(() => tableOperator.AddItems(puns)).Wait(); }
public static void Main(string[] args) { Console.WriteLine("Starting Star Wars Puns Data"); Console.WriteLine("Starting Star Wars Puns Data - Provisioning"); AmazonDynamoDBClient client = GetDynamoDBClient(); string tableName = CONFIG.GetSection("Application")["TableName"]; Console.WriteLine(string.Format("Start Working on Table: {0}", tableName)); TableOperator tableOperator = new TableOperator(client, tableName); string command = args[0]; string path = args.Length == 2 ? args [1] : ""; switch (command) { case "rebuild": { Rebuild(tableOperator); break; } case "populate": { Populate(tableOperator, path); break; } default: throw new ArgumentOutOfRangeException(command); } Console.WriteLine(string.Format("Finished Working on Table: {0}", tableName)); Console.WriteLine("Finished Star Wars Puns Data - Provisioning"); Console.WriteLine("Closing Star Wars Puns Data"); }
public static void Rebuild(TableOperator tableOperator) { Task.Run(() => tableOperator.DeleteTable()).Wait(); Task.Run(() => tableOperator.CreateTable()).Wait(); }