public Task <T> FirstOrDefaultAsync()
 {
     return(Task <T> .Factory.StartNew(() => {
         using (((SQLiteConnectionWithLock)_innerQuery.Connection).Lock()) {
             return _innerQuery.FirstOrDefault();
         }
     }));
 }
Exemple #2
0
 public Task <T> FirstOrDefaultAsync(
     CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Task.Factory.StartNew(
                () =>
     {
         cancellationToken.ThrowIfCancellationRequested();
         using (_db.Lock())
         {
             cancellationToken.ThrowIfCancellationRequested();
             return _innerQuery.FirstOrDefault();
         }
     }, cancellationToken, _taskCreationOptions,
                _taskScheduler ?? TaskScheduler.Default));
 }