static void Main(string[] args) { if (args.Length > 0) // pass any argument to to command line to force use of persisted data. { inMemoryOnly = false; } HighAvailability ha = new HighAvailability(); try { if (!Directory.Exists(s_systemDir)) { Directory.CreateDirectory(s_systemDir); } File.Copy(s_licenseDbFile, Path.Combine(s_systemDir, "4.odb")); ha.CreateDataWithBackupServer(); ha.ReadSomeData(); ha.CreateMoreDataWithBackupServer(); ha.ReadSomeData(); if (Directory.Exists(s_systemDir)) { Directory.Delete(s_systemDir, true); // remove our current systemDir and all its databases. } ha.RestoreToBackupServer(); string t = systemHost; // swap backupHost and systemHost systemHost = backupHost; backupHost = t; ha.ReadSomeData(); ha.CreateMoreDataWithBackupServer(); ha.ReadSomeData(); ha.DeleteBackupLocation(); ha.DeleteDefaultLocation(); // so that we can rerun this sample } catch (Exception ex) { Console.WriteLine("Exception: {0}", ex); } }
static void Main(string[] args) { if (args.Length > 0) // pass any argument to to command line to force use of persisted data. inMemoryOnly = false; HighAvailability ha = new HighAvailability(); try { if (!Directory.Exists(s_systemDir)) Directory.CreateDirectory(s_systemDir); File.Copy(s_licenseDbFile, Path.Combine(s_systemDir, "4.odb")); ha.CreateDataWithBackupServer(); ha.ReadSomeData(); ha.CreateMoreDataWithBackupServer(); ha.ReadSomeData(); if (Directory.Exists(s_systemDir)) Directory.Delete(s_systemDir, true); // remove our current systemDir and all its databases. ha.RestoreToBackupServer(); string t = systemHost; // swap backupHost and systemHost systemHost = backupHost; backupHost = t; ha.ReadSomeData(); ha.CreateMoreDataWithBackupServer(); ha.ReadSomeData(); ha.DeleteBackupLocation(); ha.DeleteDefaultLocation(); // so that we can rerun this sample } catch (Exception ex) { Console.WriteLine("Exception: {0}", ex); } }