/// <exception cref="System.IO.IOException"></exception>
        private void RunDefrag(string testFileName)
        {
            IConfiguration config = Db4oFactory.NewConfiguration();

            config.AllowVersionUpdates(true);
            ConfigureForTest(config);
            IObjectContainer oc = Db4oFactory.OpenFile(config, testFileName);

            oc.Close();
            string backupFileName = Path.GetTempFileName();

            try
            {
                DefragmentConfig defragConfig = new DefragmentConfig(testFileName, backupFileName
                                                                     );
                defragConfig.ForceBackupDelete(true);
                ConfigureForTest(defragConfig.Db4oConfig());
                defragConfig.ReadOnly(!DefragmentInReadWriteMode());
                Db4objects.Db4o.Defragment.Defragment.Defrag(defragConfig);
            }
            finally
            {
                File4.Delete(backupFileName);
            }
        }
Beispiel #2
0
        public void DisableReadOnlyForBackup()
        {
            // #example: Disable readonly on backup
            DefragmentConfig config = new DefragmentConfig("database.db4o");

            config.ReadOnly(false);

            Defragment.Defrag(config);
            // #end example
        }