Work class question
ilya
Posts: 19
Hi! Should I dispose Work.ExecutionBlock after using of Work object, if I didn't use the executionBlock property?
I use a Work object to get Warnings and Sqlsqript(via ScriptObject).
But from the docs is not clear, if an object of executionBlock is also created with the Work object and should be disposed
or
it will be created only if Work.ExceutionBlock property will be used (if I write ExecutionBlock eb = work.ExecutionBlock;).
I use a Work object to get Warnings and Sqlsqript(via ScriptObject).
But from the docs is not clear, if an object of executionBlock is also created with the Work object and should be disposed
or
it will be created only if Work.ExceutionBlock property will be used (if I write ExecutionBlock eb = work.ExecutionBlock;).
Comments
I'd say no, because the ExecutionBlock doesn't contain any data unless Work.BuildFromDifferences is run. It may be important to run Dispose() on the ExecutionBlock when it has been populated, because ExecutionBlock could potentially leave large SQL script files in your temporary files folder that really should be cleaned up.
So I would say that unless you had previously run BuildFromDifferences on the Work object, you wouldn't need to dispose the ExecutionBlock.
I hope this helps!