/// <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);
		}
Exemple #2
0
        /// <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);
        }