Example #1
0
        static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("Please pass connection string as first parameter and destination folder as second parameter.");
                return;
            }

            Console.Write("Writing to folder " + args[1] + "... ");
            using (MySqlConnection conn = new MySqlConnection(args[0]))
            {
                MySqlCommand cmd = new MySqlCommand();
                MySqlBackup  mb  = new MySqlBackup(cmd);
                cmd.Connection = conn;
                conn.Open();

                mb.ExportToFolder(args[1]);
            }

            Console.WriteLine("done.");
            Console.WriteLine();
            Console.Write("Reading from folder " + args[1] + "... ");

            using (MySqlConnection conn = new MySqlConnection(args[0]))
            {
                MySqlCommand cmd = new MySqlCommand();
                MySqlBackup  mb  = new MySqlBackup(cmd);
                cmd.Connection = conn;
                conn.Open();
                mb.ImportFromDirectory(args[1]);
            }

            Console.WriteLine("done.");
        }
Example #2
0
        static void Main(string[] args)
        {
            XDocument xdoc = XDocument.Load("talete.net/Web.config");
            var       path = xdoc.Element("configuration").Element("connectionStrings").Element("add").Attribute("connectionString").Value;

            using (MySqlConnection conn = new MySqlConnection(path))
            {
                MySqlCommand cmd = new MySqlCommand();
                MySqlBackup  mb  = new MySqlBackup(cmd);
                cmd.Connection = conn;
                conn.Open();
                mb.ImportFromDirectory("talete_development");
            }
        }