Im working on an automation script in which I must delete the instances of a definitions. For this, I am using the same method implemented in the generic DOM Editor script.
For around 4000 instances the deletion is taking around 20 minutes.
Is there a more efficient option for performing the deletion?
Hi Daniela,
You can delete multiple instances at once in batches of max 100 objects (docs).
public void BulkDeleteInstances<T>(ICollection<T> instances) where T : InstanceBase<T>
{
if (instances == null)
{
throw new ArgumentNullException(nameof(instances));
}foreach (var x in instances.Batch(100))
{
DomHelper.DomInstances.Delete(x.Select(y => y.Instance).ToList());
}
}
Hi Daniela,
You can probably adjust the preferredPageSize value for the .PreparePaging() method. I believe the default size is 500, but you could try increasing it to see if the deletion occurs faster with more instances per page, or decreasing it to check if it processes faster with fewer instances per page.
here is some documentation about that: Method PreparePaging | DataMiner Docs