public async Task ResetAsync(Type[] entityTypes, bool justDrop = false) { connection.RunInLock((SQLiteConnection c) => { foreach (var type in entityTypes) { try { c.DeleteAll(c.GetMapping(type)); } catch { // TODO: error handling } if (!justDrop) { try { c.CreateTable(type); } catch { // TODO: error handling } } } }); }
public override async Task SaveCurrentCheckpointAsync(string projectorIdentifier, int checkpoint) { void Run() { connection.RunInLock((SQLiteConnection conn) => { var cmd = conn.CreateCommand("UPDATE CheckpointInfos SET checkpointnumber=@p0 WHERE CheckpointInfos.statemodel=@p1"); cmd.Bind("@p0", checkpoint); cmd.Bind("@p1", projectorIdentifier); var res = cmd.ExecuteNonQuery(); if (res == 0) { cmd.CommandText = "INSERT INTO CheckpointInfos (statemodel, checkpointnumber) VALUES (@p0, @p1)"; cmd.Bind("@p0", projectorIdentifier); cmd.Bind("@p1", checkpoint); cmd.ExecuteNonQuery(); } }); } try { Run(); } catch { if (!connection.TableExists("CheckpointInfos")) { connection.CreateTable(typeof(CheckpointInfo)); Run(); } } }