private void SyncFederationMenuItem_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; FederationViewModel view = (FederationViewModel)menuItem.DataContext; FederationInfo info = view.Federationinfo; SessionBase session = view.Session; var lDialog = new System.Windows.Forms.FolderBrowserDialog() { Description = "Choose Federation Sync Destination Folder", }; if (lDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string destdir = lDialog.SelectedPath; if (session.InTransaction) { session.Commit(); // must not be in transaction while copying databases } using (SessionBase sessionDestination = new SessionNoServer(destdir)) { sessionDestination.SyncWith(session); } m_viewModel = new AllFederationsViewModel(); base.DataContext = m_viewModel; MessageBox.Show("Databases synced with " + destdir + " at " + DateTime.Now); } }
public void bSyncDeletedDatabases() { using (SessionBase session = new SessionNoServer(s_sync1)) { using (var trans = session.BeginUpdate()) { for (uint i = 10; i < 14; i++) { var database = session.OpenDatabase(i); session.DeleteDatabase(database); } session.Commit(); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { using (SessionBase updateSession = new SessionNoServer(s_sync2)) { updateSession.SyncWith(readFromSession); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { readFromSession.BeginRead(); using (SessionBase updateSession = new SessionNoServer(s_sync2)) { using (var trans = updateSession.BeginRead()) { Assert.AreEqual(updateSession.OpenAllDatabases().Count, readFromSession.OpenAllDatabases().Count - 1); // - 1 due to additional change tracking databases in original } } } }
public void dSyncDeletePages() { using (SessionBase session = new SessionNoServer(s_sync1)) { using (var trans = session.BeginUpdate()) { foreach (FourPerPage fourPerPage in session.AllObjects <FourPerPage>()) { fourPerPage.Unpersist(session); } session.Commit(); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { using (SessionBase updateSession = new SessionNoServer(s_sync2)) { updateSession.SyncWith(readFromSession); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { readFromSession.BeginRead(); using (SessionBase updateSession = new SessionNoServer(s_sync2)) { using (var trans = updateSession.BeginRead()) { Assert.AreEqual(updateSession.AllObjects <FourPerPage>().Count, readFromSession.AllObjects <FourPerPage>().Count); } } } }
public void cSyncNewPages() { using (SessionBase session = new SessionNoServer(s_sync1)) { using (var trans = session.BeginUpdate()) { for (uint i = 0; i < 100; i++) { FourPerPage fourPerPage = new FourPerPage(i); session.Persist(fourPerPage); } session.Commit(); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { using (SessionBase updateSession = new SessionNoServer(s_sync2)) { updateSession.SyncWith(readFromSession); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { readFromSession.BeginRead(); using (SessionBase updateSession = new SessionNoServer(s_sync2)) { using (var trans = updateSession.BeginRead()) { Assert.AreEqual(updateSession.AllObjects <FourPerPage>().Count, readFromSession.AllObjects <FourPerPage>().Count); } } } }
public void aSyncNewDatabases() { using (SessionBase session = new SessionNoServer(s_sync1)) { session.EnableSyncByTrackingChanges = true; using (var trans = session.BeginUpdate()) { for (uint i = 10; i < 50; i++) { var database = session.NewDatabase(i); Assert.NotNull(database); } session.Commit(); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { using (SessionBase updateSession = new SessionNoServer(s_sync2)) { updateSession.SyncWith(readFromSession); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { readFromSession.BeginRead(); using (SessionBase updateSession = new SessionNoServer(s_sync2)) { using (var trans = updateSession.BeginRead()) { Assert.AreEqual(updateSession.OpenAllDatabases().Count, readFromSession.OpenAllDatabases().Count - 1); // - 1 due to additional change tracking databases in original } } } }
public void aSyncNewDatabases() { using (var session = new SessionNoServerShared(s_sync1)) { session.EnableSyncByTrackingChanges = true; using (var trans = session.BeginUpdate()) { for (uint i = 10; i < 50; i++) { var database = session.NewDatabase(i); Assert.NotNull(database); } session.Commit(); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { using (SessionBase updateSession = new SessionNoServer(s_sync2)) { updateSession.SyncWith(readFromSession); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { readFromSession.BeginRead(); using (SessionBase updateSession = new SessionNoServer(s_sync2)) { using (var trans = updateSession.BeginRead()) { Assert.AreEqual(updateSession.OpenAllDatabases().Count, readFromSession.OpenAllDatabases().Count - 1); // - 1 due to additional change tracking databases in original } } } }
private void SyncFederationMenuItem_Click(object sender, RoutedEventArgs e) { MenuItem menuItem = (MenuItem)sender; FederationViewModel view = (FederationViewModel)menuItem.DataContext; FederationInfo info = view.Federationinfo; SessionBase session = view.Session; var lDialog = new System.Windows.Forms.FolderBrowserDialog() { Description = "Choose Federation Sync Destination Folder", }; if (lDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string destdir = lDialog.SelectedPath; if (session.InTransaction) session.Commit(); // must not be in transaction while copying databases using (SessionBase sessionDestination = new SessionNoServer(destdir)) { sessionDestination.SyncWith(session); } m_viewModel = new AllFederationsViewModel(); base.DataContext = m_viewModel; MessageBox.Show("Databases synced with " + destdir + " at " + DateTime.Now); } }
public void dSyncDeletePages() { using (SessionBase session = new SessionNoServer(s_sync1)) { using (var trans = session.BeginUpdate()) { foreach (FourPerPage fourPerPage in session.AllObjects<FourPerPage>()) fourPerPage.Unpersist(session); session.Commit(); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { using (SessionBase updateSession = new SessionNoServer(s_sync2)) { updateSession.SyncWith(readFromSession); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { readFromSession.BeginRead(); using (SessionBase updateSession = new SessionNoServer(s_sync2)) { using (var trans = updateSession.BeginRead()) { Assert.AreEqual(updateSession.AllObjects<FourPerPage>().Count, readFromSession.AllObjects<FourPerPage>().Count); } } } }
public void cSyncNewPages() { using (SessionBase session = new SessionNoServer(s_sync1)) { using (var trans = session.BeginUpdate()) { for (uint i = 0; i < 100; i++) { FourPerPage fourPerPage = new FourPerPage(i); session.Persist(fourPerPage); } session.Commit(); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { using (SessionBase updateSession = new SessionNoServer(s_sync2)) { updateSession.SyncWith(readFromSession); } } using (SessionBase readFromSession = new SessionNoServer(s_sync1)) { readFromSession.BeginRead(); using (SessionBase updateSession = new SessionNoServer(s_sync2)) { using (var trans = updateSession.BeginRead()) { Assert.AreEqual(updateSession.AllObjects<FourPerPage>().Count, readFromSession.AllObjects<FourPerPage>().Count); } } } }