/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception> public override IBin Open(BinConfiguration config) { SaveAsStorage.SaveAsBin openedBin = new SaveAsStorage.SaveAsBin(base.Open(config) ); _binRecords.Put(config.Uri(), new SaveAsStorage.BinRecord(config, openedBin)); return(openedBin); }
public _IRunnable_49(SaveAsStorage _enclosing, SaveAsStorage.SaveAsBin saveAsBin, string oldUri, string newUri, BinConfiguration oldConfiguration) { this._enclosing = _enclosing; this.saveAsBin = saveAsBin; this.oldUri = oldUri; this.newUri = newUri; this.oldConfiguration = oldConfiguration; }
private void ReopenOldConfiguration(SaveAsStorage.SaveAsBin saveAsBin, BinConfiguration config, string newUri, Exception e) { IBin safeBin = _storage.Open(config); saveAsBin.DelegateTo(safeBin); throw new Db4oException("Copying to " + newUri + " failed. Reopened " + config.Uri (), e); }
/// <summary> /// call this method to save the content of a currently /// open ObjectContainer session to a new file location. /// </summary> /// <remarks> /// call this method to save the content of a currently /// open ObjectContainer session to a new file location. /// Invocation will close the old file without a commit, /// keep the reference system in place and connect it to /// the file in the new location. If anything goes wrong /// during the copying operation or while opening it will /// be attempted to reopen the old file. In this case a /// Db4oException will be thrown. /// </remarks> /// <param name="oldUri">the path to the old open database file</param> /// <param name="newUri">the path to the new database file</param> public virtual void SaveAs(string oldUri, string newUri) { if (System.IO.File.Exists(newUri)) { throw new InvalidOperationException(newUri + " already exists"); } SaveAsStorage.BinRecord binRecord = (SaveAsStorage.BinRecord)_binRecords.Get(oldUri ); if (binRecord == null) { throw new InvalidOperationException(oldUri + " was never opened or was closed."); } BinConfiguration oldConfiguration = binRecord._binConfiguration; SaveAsStorage.SaveAsBin saveAsBin = binRecord._bin; IRunnable closure = new _IRunnable_49(this, saveAsBin, oldUri, newUri, oldConfiguration ); saveAsBin.ExchangeUnderlyingBin(closure); }
internal BinRecord(BinConfiguration binConfiguration, SaveAsStorage.SaveAsBin bin ) { _binConfiguration = binConfiguration; _bin = bin; }
/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception> public override IBin Open(BinConfiguration config) { SaveAsStorage.SaveAsBin openedBin = new SaveAsStorage.SaveAsBin(base.Open(config) ); _binRecords.Put(config.Uri(), new SaveAsStorage.BinRecord(config, openedBin)); return openedBin; }