Esempio n. 1
0
 private void SetValueCore(DatabaseManagement mgmt)
 {
     // synchronized insert
     try
     {
         using (Descriptor.AcquireWriteLock())
             using (var con = Descriptor.GetConnection())
                 using (var tr = con.BeginTransaction(DatabaseConnectionHelper.DefaultIsolationLevel))
                 {
                     con.Execute(this.TableInserter, mgmt);
                     tr.Commit();
                 }
     }
     catch (Exception ex)
     {
         throw DatabaseConnectionHelper.WrapException(ex, "SetValueCore", this.TableInserter);
     }
 }
Esempio n. 2
0
 internal async Task VacuumAsync()
 {
     await Descriptor
     .GetTaskFactory(true)
     .StartNew(() =>
     {
         // should execute WITHOUT transaction.
         try
         {
             using (Descriptor.AcquireWriteLock())
                 using (var con = Descriptor.GetConnection())
                 {
                     con.Execute("VACUUM;");
                 }
         }
         catch (Exception ex)
         {
             throw DatabaseConnectionHelper.WrapException(ex, "VacuumAsync", this.TableInserter);
         }
     });
 }