What is the difference between CloudBlob's SetMetadata and BeginSetMetadata ?

Răspuns What is the difference between CloudBlob's SetMetadata and BeginSetMetadata ?

  • Monday, September 24, 2012 10:05 AM
     
     
    What is the difference between CloudBlob's SetMetadata and BeginSetMetadata ?

    http://www.ransen.com Cad and Graphics software

All Replies

  • Monday, September 24, 2012 10:34 AM
     
     
    SetMetadata is a synchronous call whereas BeginSetMetadata is an asynchronous one.

    If this answers your question, please Mark it as Answer. If this post is helpful, please vote as helpful.

  • Monday, September 24, 2012 10:35 AM
     
     
    Hi Owen, BeginSetMetadata  is an asynchronous operation, SetMetadata is synchronous. Both do the same operation.
  • Monday, September 24, 2012 11:17 AM
     
     

    Thanks for the replies both of you.

    Does that mean that when SetMetadata returns the blobs data has already been updated and saved?

    And BeginSetMetadata is used maybe when you think the operation will take some time?


    http://www.ransen.com Cad and Graphics software

  • Monday, September 24, 2012 11:28 AM
     
     Answered
    Yes, when SetMetadata returns, the work is done. You can use BeginSetMetadata to do the operation in background. If this operation take a lot, it's a great idea to user BeginSetMetada to do the operation in background.
    • Marked As Answer by Owen Ransen Monday, September 24, 2012 12:04 PM
    •  
  • Monday, September 24, 2012 11:31 AM
     
     Answered Has Code
    Does that mean that when SetMetadata returns the blobs data has already been updated and saved?

    Yes

    And BeginSetMetadata is used maybe when you think the operation will take some time?

    Yes, but I would rather say it's quite driven by your application design and requirement. Anyway, to understand the completion status of BeginSetMetadata async call you may make use of while IsCompleted property of IAsyncResult returned by it. E.g.

    while (!aResult.IsCompleted)
    {
    // Perform other operations
    }
    Alternately, you can make use of callback delegate which is passed as 2nd argument to BeginSetMetadata method. It will receive notification when the asynchronous operation completes.

    HTH

    Sameer


    If this answers your question, please Mark it as Answer. If this post is helpful, please vote as helpful.


    • Edited by Sameer Awate Monday, September 24, 2012 11:33 AM
    • Marked As Answer by Owen Ransen Monday, September 24, 2012 12:05 PM
    •  
  • Monday, September 24, 2012 12:06 PM
     
     

    Many thanks, you've given me food for thought!


    http://www.ransen.com Cad and Graphics software

  • Monday, September 24, 2012 12:06 PM
     
     
    Thanks for the help.  :)

    http://www.ransen.com Cad and Graphics software