PurgeDataset() public method

Physically deletes the whole dataset, including its versions and data tuples, from the database.
There is no way to recover the dataset after this method has successfully purged it.
public PurgeDataset ( System.Int64 datasetId ) : bool
datasetId System.Int64 The identifier of the dataset to be checked-in.
return bool
Example #1
0
 private void purgeDataset(long dsId)
 {
     DatasetManager dm = new DatasetManager();
     dm.PurgeDataset(dsId);
 }
Example #2
0
        /// <summary>
        /// Purges a dataset, which means the dataset and all its versions will be physically removed from the database.
        /// </summary>
        /// <param name="id">the identifier of the dataset to be purged.</param>
        /// <remarks>This operation is not revocerable.</remarks>
        /// <returns></returns>
        public ActionResult Purge(long id)
        {
            ViewBag.Title = PresentationModel.GetViewTitleForTenant("Purge", this.Session.GetTenant());
            bool itsFine = false;
            DatasetManager dm = new DatasetManager();
            try
            {
                if (dm.PurgeDataset(id))
                {
                    itsFine = true;
                }
            }
            catch (Exception ex)
            {
                try // give it another try
                {
                    if (dm.PurgeDataset(id, true))
                    {
                        itsFine = true;
                    }
                }
                catch (Exception exx)
                {
                    ViewData.ModelState.AddModelError("", string.Format("Dataset {0} could not be purged. Details: {1}, see also: {2}", id, exx.Message, ex.Message));
                }
            }

            if (itsFine)
            {
                try
                {
                    PermissionManager pm = new PermissionManager();
                    pm.DeleteDataPermissionsByEntity(1, id);
                }
                catch
                {
                    ViewData.ModelState.AddModelError("", string.Format("Dataset {0} was purged, but its permissions were not altered. You need to remove them manually from the data permission management.", id));
                }
                try
                {
                    ISearchProvider provider = IoCFactory.Container.ResolveForSession<ISearchProvider>() as ISearchProvider;
                    provider?.UpdateSingleDatasetIndex(id, IndexingAction.DELETE);
                }
                catch
                {
                    ViewData.ModelState.AddModelError("", string.Format("Dataset {0} was purged, but it is still indexed for searching. You need to reindex the search via the managemnet console.", id));
                }
            }
            return View();
        }
Example #3
0
 private void purgeAll()
 {
     DatasetManager dm = new DatasetManager();
     foreach (var item in dm.DatasetRepo.Query().Select(p => p.Id).ToList())
     {
         dm.PurgeDataset(item);
     }
 }