ServiceStack/ServiceStack — pull request #96 by mj1856 (2012-02-11 19:37:38+00:00)
Title: Silverlight Client Enhancements

1. Fixedup ServiceClientBase to merge sl and non-sl sections with inline conditional statements. This is better than splitting the whole class, as it keeps future changes in sync.

2. Removed synchronous non-implemented method calls. Silverlight cannot make synchronous requests, so the methods should not exist, rather than throwing NotImplementedExceptions. For silverlight, removed the IRestClient interface and took IReplyClient away from IServiceClient. This leaves just IServiceClientAsync and IOneWayClient as defined in IServiceClient.

3. Added three boolean options to ServiceClientBase only for silverlight:

+ _HandleCallbackOnUIThread - defaults to true._ This is the desired behavior in most cases, but there could be some cases where the client specifically wants a callback on the background thread and then handles their own marshalling to the UI thread. In that case, set this to false.

+ _UseBrowserHttpHandling - defaults to false._ The previous client implicitly used browser handling, which is non-optimal for service calls. Now we specifically use client handling, unless asked otherwise by setting this flag to false.

+ _ShareCookiesWithBrowser - defaults to true._ Because we switched to client http handling, we now need to handle cookies ourself. This flag sets the default behavior to share cookies witht the browser via Silverlight's System.Windows.Browser.HtmlPage.Document.Cookies interface. Alternatively, you can set this flag to false and then provide your own CookieContainer. Note, if StoreCookies is set false, or UseBrowserHttpHandling is set true, then this behavior is always disabled.