Frage Silverlight object model async or sync calls

  • Samstag, 14. April 2012 19:19
     
     

    Hello All,

    Whether SharePoint 2010 Silverlight Client Object Model calls (ExecuteQuery() i.e, Synchronous call) or (ExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler) i.e, Asynchronous call)? or both?

    According to this article it uses both. But on internet we don't have examples on ExecuteQuery() method.

    Somebody clarify me.Thnx


    Like Cricket

Alle Antworten

  • Samstag, 14. April 2012 19:55
    Moderator
     
     
    You can use both, but if you are executing commands in the main UI thread you have to use the asynchronous method.

    Regards Bjoern

  • Montag, 16. April 2012 13:57
     
     

    Thanks for the reply

    Can I have an example for Synchronous call(ExecuteQuery())?


    Like Cricket

  • Montag, 16. April 2012 19:56
     
     
    Silverlight only allows ansynchronous calls.

    Blog | SharePoint Field Notes Dev Tool | ClassMaster

  • Montag, 16. April 2012 21:31
    Moderator
     
     
    Steve, that's not entirely true, it's possible to use synchronous calls in threads  that don't  interact with the UI thread.

    Regards Bjoern

  • Montag, 16. April 2012 21:46
     
      Enthält Code

    I understand. An asynchronous call is launching another thread. It is easier to call and manage the return values by calling the ExecuteQueryAsync than manually creating another thread and another delegate just to call the synchronous method. It is easy to manage async calls in Silverlight with in-line delegates.

    context.ExecuteQueryAsync((object eventSender, ClientRequestSucceededEventArgs args1) =>
                { }, (object sender, ClientRequestFailedEventArgs eventArgs) =>
                {
                    string message = eventArgs.Message;
                }
                );


    Blog | SharePoint Field Notes Dev Tool | ClassMaster

  • Dienstag, 17. April 2012 13:33
     
     

    Hi  Bjoern H Rapp,

    can you please share any link for sync calls also in SilverLight?


    Like Cricket