public override async Task <int> LoadLastCheckpointAsync(string projectorIdentifier) { TCheckpointInfo checkpointInfo = null; try { checkpointInfo = connection.Get <TCheckpointInfo>(projectorIdentifier); } catch { try { if (!connection.TableExists("CheckpointInfos")) { connection.CreateTable(typeof(CheckpointInfo)); checkpointInfo = connection.Get <TCheckpointInfo>(projectorIdentifier); } } catch { } // TODO: error handling } if (checkpointInfo == null) { return(-1); } return(checkpointInfo.CheckpointNumber); }
public Task <T> GetAsync <T>(Expression <Func <T, bool> > predicate) where T : new() { if (predicate == null) { throw new ArgumentNullException("predicate"); } return(Task.Factory.StartNew(() => { SQLiteConnectionWithLock conn = GetConnection(); using (conn.Lock()) { return conn.Get(predicate); } }, CancellationToken.None, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default)); }
public Task <T> GetAsync <T>(object pk) where T : new() { if (pk == null) { throw new ArgumentNullException("pk"); } return(Task.Factory.StartNew(() => { SQLiteConnectionWithLock conn = GetConnection(); using (conn.Lock()) { return conn.Get <T>(pk); } }, CancellationToken.None, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default)); }
public Task <T> GetAsync <T>(Expression <Func <T, bool> > predicate) where T : new() { if (predicate == null) { throw new ArgumentNullException("predicate"); } return(_taskFactory.StartNew(() => { SQLiteConnectionWithLock conn = GetConnection(); using (conn.Lock()) { return conn.Get(predicate); } })); }
public Task <T> GetAsync <T>(object pk) where T : new() { if (pk == null) { throw new ArgumentNullException("pk"); } return(_taskFactory.StartNew(() => { SQLiteConnectionWithLock conn = GetConnection(); using (conn.Lock()) { return conn.Get <T>(pk); } })); }
public Recipe FindRecipe(int id) { if (_isDisposed) { throw new ObjectDisposedException(nameof(RecipePersistenceService)); } if (id <= 0) { throw new ArgumentOutOfRangeException(nameof(id)); } RecipeRow row = null; using (_connection.Lock()) { row = _connection.Get <RecipeRow>(x => x.Id == id); } return(row?.ToRecipe(_referenceBook)); }