コード例 #1
0
ファイル: Program.cs プロジェクト: kevelairn/AgDatabaseMove
        private static void Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .AddCommandLine(args);
            var arguments = builder.Build().Get <MoveArgs>();

            var from = new AgDatabase(arguments.From);
            var to   = new AgDatabase(arguments.To);

            // TODO: This should be baked into the restore class. We have a property for it.
            if (arguments.Overwrite)
            {
                to.Delete();
            }

            Console.WriteLine("Beginning restore...");
            var restore = new Restore(from, to)
            {
                CopyLogins    = arguments.CopyLogins,
                FileRelocator = fileName => RestoreFileRelocator(from.Name, to.Name, fileName), Finalize = arguments.Finalize,
                Overwrite     = arguments.Overwrite
            };

            from.LogBackup();
            restore.AgDbRestore();
            Console.WriteLine("Restore completed.");

            Console.WriteLine("Deleting source.");
            from.Delete();
            Console.WriteLine("Source deleted");
        }