title: Silverlight 4 accessing WCF Data Services: BeginInvoke frustrations
body: <p>I'm attempting to follow a pattern for performing WCF data service queries using the Silverlight 4 beta.  The following is my code:</p>
  
  <pre><code>    public CodeTables()
      {
          CodeCountries = new ObservableCollection&lt;dsRealHomes.CodeCountries&gt;();
  
          dsRealHomes.RealHomesEntities myClient = null;
          myClient = staticGlobals.RealHomesContext();
  
          object userState = null;
  
  
          myClient.BeginExecute&lt;dsRealHomes.CodeCountries&gt;(new Uri("CodeCountries"),
          (IAsyncResult asyncResult) =&gt;
          {
              Dispatcher.BeginInvoke(
                   () =&gt;
                   {
                       var test = myClient.EndExecute&lt;dsRealHomes.CodeCountries&gt;asyncResult).ToList();
                   }
               );
          }, userState);
      }
  </code></pre>
  
  <p>This is derived from a number of examples I've come across for WCF data services with silverlight.  Unfortunately no matter how I try to implement the code i end up with the following error on 'Dispatcher.BeginInvoke':</p>
  
  <blockquote>
    <p>'An object reference is required for the non-static field, method, or property (System.Windows.Threading.Dispatcher.BeginInvoke(System.Action)'</p>
  </blockquote>