Example #1
0
 public bool Delete(CMPModelBase item)
 {
     try
     {
         using (var sqliteConnection = new SQLiteConnection(_dbPathString))
         {
             var result = sqliteConnection.Delete(item);
             sqliteConnection.Close();
             return(result > 0);
         }
     }
     catch (SQLiteException exception)
     {
         Diagnostics.Debug.WriteLine(exception.StackTrace);
         return(false);
     }
 }
Example #2
0
        public async Task <bool> DeleteAsync(CMPModelBase item)
        {
            try
            {
                await _dbSemaphore.WaitAsync();

                var sqliteAsyncConnection = new SQLiteAsyncConnection(_dbPathString);
                var deleteResult          = await sqliteAsyncConnection.DeleteAsync(item);

                _dbSemaphore.Release();
                return(deleteResult > 0);
            }
            catch (SQLiteException exception)
            {
                Diagnostics.Debug.WriteLine(exception.StackTrace);
                _dbSemaphore.Release();
                return(false);
            }
        }