Esempio n. 1
0
        private void DeleteIndex(string deleteItems)
        {
            var ravenDocumentsByEntityNameIndexName = new RavenDocumentsByEntityName().IndexName;
            var tasks = (from indexListItem in model.IndexesOfPriority(deleteItems)
                         select indexListItem.Name
                         into indexName
                         where indexName != ravenDocumentsByEntityNameIndexName
                         select new { Task = DatabaseCommands.DeleteIndexAsync(indexName), Name = indexName }).ToArray();

            Task.Factory.ContinueWhenAll(tasks.Select(x => x.Task).ToArray(), taskslist =>
            {
                foreach (var task in taskslist)
                {
                    var indexName = tasks.First(x => x.Task == task).Name;
                    if (task.IsFaulted)
                    {
                        ApplicationModel.Current.AddErrorNotification(task.Exception, "index " + indexName + " could not be deleted");
                    }
                    else
                    {
                        ApplicationModel.Current.AddInfoNotification("Index " + indexName + " successfully deleted");
                        var deletedItem = model.GroupedIndexes.OfType <IndexItem>().FirstOrDefault(item => item.Name == indexName);
                        model.GroupedIndexes.Remove(deletedItem);
                    }
                }

                UrlUtil.Navigate("/indexes");
            });
        }
Esempio n. 2
0
        private void DeleteIndex(string deleteItems)
        {
            var ravenDocumentsByEntityNameIndexName = new RavenDocumentsByEntityName().IndexName;
            var indexes = (from indexListItem in model.IndexesOfPriority(deleteItems)
                           where indexListItem.Name != ravenDocumentsByEntityNameIndexName
                           select indexListItem.Name);


            DeleteIndexes(indexes);
        }