Hi,
I'm attempting to follow a pattern for performing WCF data service queries using the Silverlight 4 beta. The following is my code:
public CodeTables()
{
CodeCountries = new ObservableCollection<dsRealHomes.CodeCountries>();
dsRealHomes.RealHomesEntities myClient = null;
myClient = staticGlobals.RealHomesContext();
object userState = null;
myClient.BeginExecute<dsRealHomes.CodeCountries>(new Uri("CodeCountries"),
(IAsyncResult asyncResult) =>
{
Dispatcher.BeginInvoke(
() =>
{
var test = myClient.EndExecute<dsRealHomes.CodeCountries>asyncResult).ToList();
}
);
}, userState);
}
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':
'An object reference is required for the non-static field, method, or property (System.Windows.Threading.Dispatcher.BeginInvoke(System.Action)'
Thanks