protected static void LoadRecords <T>(IBulkInsertContext context, List <T> records, string message, ConsoleTicker consoleTicker) where T : class { if (message != null) { Console.Write(message + "...\r"); } consoleTicker.ResetTicker(); var count = context.BulkAddAll(records, message != null ? () => consoleTicker.TickConsole(message + "...") : (Action)null); consoleTicker.ReplaceCurrentLine("{0}: {1} records.", message, count); }
protected static void LoadRecords <T>(IBulkInsertContext context, IEnumerable <T> records, string message, ConsoleTicker consoleTicker, int?takeLimit = null) where T : class { if (message != null) { Console.Write(message + "...\r"); } var recordsList = takeLimit != null?records.Take(takeLimit.Value).ToList() : records.ToList(); consoleTicker.ResetTicker(); var count = context.BulkAddAll(recordsList, message != null ? () => consoleTicker.TickConsole(message + "...") : (Action)null); consoleTicker.ReplaceCurrentLine("{0}: {1} records.", message, count); }