Search code examples
c#tfsworkitem

Does TFS API WorkItemStore.BatchSave(WorkItem[]) method close the opened work items?


Recently I came across an issue when I was trying to enhance the performance of updating work items in the data base using TFS API. I have more than a million work items to update and I separated them in tasks to enhance the performance. Unfortunately I have to Open and not just PartialOpen the work items and I was wondering if the WorkItemStore.BatchSave(WorkItem[]) method would close the work items and frees up the memory, or should I have to close the work items in the work item array myself? Does anybody has experience with this issue?

Thank you in advance!


Solution

  • The documentation of the Close method states that

    Closes this WorkItem instance and frees memory that is associated with it.

    Save and BatchSave don't do this. In fact you can inspect the result, tweak the object data and retry the operation.

    Forgot to say: check the WorkItemStore.MaxBulkUpdateBatchSize property value to manage your batches.