コード例 #1
0
        /*\ ***** ***** ***** ***** ***** Public Methods ***** ***** ***** ***** ***** \*/
        public async Task <IList <string> > DeleteAsync <T>(IRavenQueryable <T> query, bool allowStale)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }

            var operation = await _commands.DeleteByIndexAsync(GetIndexName(query), GetIndexQuery(query), new BulkOperationOptions { AllowStale = allowStale });

            var token = await operation.WaitForCompletionAsync();

            var results = token.Value <RavenJArray>();

            var ids = from document in results.Values <RavenJObject>()
                      where document.ContainsKey("Document")
                      select document["Document"].Value <string>();

            return(ids.Distinct()
                   .ToList());
        }