public Task <T> FirstAsync() { return(Task <T> .Factory.StartNew(() => { using (((SQLiteConnectionWithLock)_innerQuery.Connection).Lock()) { return _innerQuery.First(); } })); }
public Task <T> FirstAsync(CancellationToken cancellationToken = default(CancellationToken)) { return(Task.Factory.StartNew( () => { cancellationToken.ThrowIfCancellationRequested(); using (_db.Lock()) { cancellationToken.ThrowIfCancellationRequested(); return _innerQuery.First(); } }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default)); }