示例#1
0
 public Task <T> FirstAsync()
 {
     return(Task <T> .Factory.StartNew(() => {
         using (((SQLiteConnectionWithLock)_innerQuery.Connection).Lock()) {
             return _innerQuery.First();
         }
     }));
 }
示例#2
0
 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));
 }