Work class question

ilyailya Posts: 19
edited August 5, 2008 3:54AM in SQL Toolkit Previous Versions
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;).

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Ilya,

    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!
  • Hi Brian, thank you! it has helped! :)
Sign In or Register to comment.