Example #1
0
 private static void ExecuteQuery(string query,
                                  Action<SQLiteCommand, IEntity> commandBinder,
                                  IEntity entity,
                                  Action<SQLiteCommand> execute)
 {
     SQLiteConnection conn = null;
     SQLiteCommand cmd = null;
     try
     {
         conn = new SQLiteConnection(ConnectionString);
         cmd = new SQLiteCommand(query, conn);
         commandBinder?.Invoke(cmd, entity);
         conn.Open();
         execute(cmd);
     }
     finally
     {
         cmd?.Dispose();
         if (conn != null)
         {
             conn.Close();
             conn.Dispose();
         }
         SQLiteConnection.ClearAllPools();
     }
 }