Where best to instantiate and close a Silverlight-enabled WCF Service from the Silverlight app?
        Posted  
        
            by Yttrium
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Yttrium
        
        
        
        Published on 2008-11-10T20:07:35Z
        Indexed on 
            2010/06/15
            12:52 UTC
        
        
        Read the original article
        Hit count: 217
        
When using a Silverlight-enabled WCF service, where is the best place to instantiate the service and to call the CloseAsync() method?
Should you say, instantiate an instance each time you need to make a call to the service, or is it better to just instantiate an instance as a variable of the UserControl that will be making the calls?
Then, where is it better to call the CloseAsync method? Should you call it in each of the "someServiceCall_completed" event methods? Or, if created as a variable of the UserControl class, is there a single place to call it? Like a Dispose method, or something equivalent for the UserControl class.
Thanks,
Jeff
© Stack Overflow or respective owner