Answered by:
Azure Storage Client (v2.0) - Disposing resources...

Question
-
What are the suggest best practices around disposing resources when working with Blob storage particularly with Managed client APIs ver 2.0 ?
None of the following components implement IDispoable (or a Close() method).
- CloudStorageAccount
- CloudBlobClient
- CloudBlobContainer
- CloudBlockBlob
Short of reviewing the source, where can I learn more about best practices around releasing resources?
Thx in adv
Wednesday, October 31, 2012 9:47 PM
Answers
-
Hi,
those resources are released automatically by the storage client library, because they're created by the library. For example, using Reflector to review the code, you may notice:
executionState.RestCMD.ResponseStream.Dispose();
And:
executionState.Resp.Close();
When designing your own class library, it is also a good idea to dispose the resources you created (but not resources created by the caller).Best Regards
- Marked as answer by Johnson - MSFT Tuesday, November 6, 2012 10:24 AM
Monday, November 5, 2012 9:39 AM
All replies
-
Hi, what do you mean by disposing resources when working with Blob storage? Delete blobs?
If your answer is yes, then you can follow below workthroughs to archieve it.
http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/
Best Regards
Thursday, November 1, 2012 7:46 AM -
Not looking for deleting or archiving blob storage content.
The question is more about releasing resources that may be held by Storage Client (eg: http connections, streams, if any). Looking at the source code of storage client, pretty much all operations seem to use transient resources.
Thursday, November 1, 2012 2:23 PM -
Hi,
those resources are released automatically by the storage client library, because they're created by the library. For example, using Reflector to review the code, you may notice:
executionState.RestCMD.ResponseStream.Dispose();
And:
executionState.Resp.Close();
When designing your own class library, it is also a good idea to dispose the resources you created (but not resources created by the caller).Best Regards
- Marked as answer by Johnson - MSFT Tuesday, November 6, 2012 10:24 AM
Monday, November 5, 2012 9:39 AM