Пример #1
0
        public void Dispose()
        {
            if (_adapter != null)
            {
                _adapter.Dispose();
                _adapter = null;
            }

            Dispose(true);
        }
Пример #2
0
        private Exception HandleStorageRelatedException(Exception e)
        {
            // Re-initialize db file if database is corrupted
            if (e is StorageCorruptedException)
            {
                AppCenterLog.Error(AppCenterLog.LogTag, "Database corruption detected, deleting the file and starting fresh...", e);
                _storageAdapter.Dispose();
                try
                {
                    new File(_databasePath).Delete();
                }
                catch (IOException fileException)
                {
                    AppCenterLog.Error(AppCenterLog.LogTag, "Failed to delete database file.", fileException);
                }
                InitializeDatabase();
            }

            // Tasks should already be throwing only storage exceptions, but in case any are missed,
            // which has happened, catch them here and wrap in a storage exception. This will prevent
            // the exception from being unobserved.
            return(e is StorageException ? e : new StorageException(e));
        }
Пример #3
0
 public void Dispose()
 {
     storageAdapter?.Dispose();
 }