Where is the best place to create and close a Silverlight WCF service using a Silverlight application?

When using a Silverlight-enabled WCF service, where is the best place to instantiate the service and call the CloseAsync () method?

If you say, create an instance of the instance every time you need to call the service, or is it better to just instantiate the instance as a UserControl variable that will make calls?

Then, where is the best name for the CloseAsync method? Should you call it in each of the someServiceCall_completed event methods? Or, if it is created as a variable of the UserControl class, is there any place for calling it? Like the Dispose method or something equivalent for the UserControl class.

Thank,

Jeff

+3
source share
2 answers

. . , , - 2 (. № 5),

, , , , . UserControl ( ), , , , , Silverlight . , , , - , , CloseAsync.

, , , . , .

+3

SL- , , : , App.Client, . 1 MyOperationCompleted, 2. :

...
{
    App.Client.MyOperationCompleted += Client_MyOperationCompleted;
    App.Client.MyOperationAsync(...);
}

void Client_MyOperationCompleted(object sender, MyOperationCompletedEventArgs e)
{
    App.Client.MyOperationCompleted -= Client_MyOperationCompleted;
}

, , , . , , ( ), . , 100% concurrency . . .

+1

Source: https://habr.com/ru/post/1699371/


All Articles