internal void Close()
{
if (!IsOpen)
throw new DatabaseSystemException("The database is not initialized.");
try {
if (Context.DeleteOnClose()) {
// Delete the tables if the database is set to delete on
// shutdown.
TableComposite.Delete();
} else {
// Otherwise close the conglomerate.
TableComposite.Close();
}
} catch (DatabaseSystemException) {
throw;
} catch (Exception e) {
throw new DatabaseSystemException("An error occurred during database shutdown.", e);
} finally {
IsOpen = false;
}
}