Exemplo n.º 1
0
        /// <summary>
        /// Returns the only document of resultset, or null if resultset are empty; this method throw an exception if there not exactly one document in the sequence
        /// </summary>
        public Task <T> SingleOrDefaultAsync()
        {
            var tcs = new TaskCompletionSource <T>();

            _liteDatabaseAsync.Enqueue(tcs, () => {
                tcs.SetResult(_wrappedQuery.SingleOrDefault());
            });
            return(tcs.Task);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the only document of resultset, or null if resultset are empty; this method throw an exception if there not exactly one document in the sequence
 /// </summary>
 public Task <T> SingleOrDefaultAsync()
 {
     return(_liteDatabaseAsync.EnqueueAsync(
                () => _wrappedQuery.SingleOrDefault()));
 }