Beispiel #1
0
        static void Main(string[] args)
        {
            try
            {
                Config.Settings = Config.LoadFromExecutablePath();
                VerifyConnectionString();

                DatabaseCommand command = DatabaseCommand.Parse(args);
                Log.i(tag, command.Description());
                System.Console.WriteLine("Using: " + Config.Settings.ConnectionString);
                Stopwatch sw = new Stopwatch();
                sw.Start();
                command.Execute();
                var totalSeconds = sw.Elapsed.TotalSeconds;
                if (totalSeconds > 5)
                {
                    Log.w(tag, "Wasted " + TimeSpanString.ToString(sw.Elapsed) + " on: " + command.Description());
                }
            }
            catch (Exception caught)
            {
                System.Console.WriteLine(caught.Message);
                Log.e(tag, caught);
                Environment.Exit(1);
            }
            finally
            {
                Log.Flush();
            }
        }