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());
}
}