Silverlight Client Library
LINQ query
At first, it seems that the linq syntax cannot be used from your context, because all requests are asynchronous, and IEnumerable does not explicitly have a BeginExecute method. To use Linq syntax, you need to specify your possible query:
var query = (DataServiceQuery<Product>)myContext.Products.Where(p => p.SupplierID == 5); query.BeginExecute(this.HandleQueryResults, query);
Note that the request has been submitted because you need to use the same instance of DataServiceQuery to call EndExecute, you cannot just use the context.
Change tracking
The client library does not automatically track field changes in generated types. To do this, you must implement INotifyPropertyChanged in your partial types.
Example:
public partial class Product : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; partial void OnProductIDChanged() { FirePropertyChanged("ProductID"); } partial void OnProductNameChanged() { FirePropertyChanged("ProductName"); } private void FirePropertyChanged(string property) { ... } }
In version 1.5, the Data Services tool can generate this for you, but it is currently only in CTP: Introduction to Data Binding in Silverlight 3 with 1.5 CTP2
Updated server data
By default, the Silverlight client context has MergeOption set to AppendOnly. This means that you will not see any changes in the objects, as soon as you request them for the first time, this is a form of caching and performance optimization. To see updates, you need to change MergeOption to OverwriteChanges, this will ensure that objects are updated. You can also throw away your context and recreate.
myContext.MergeOption = MergeOption.OverwriteChanges
Cross domain access
The types created by Silverlight for ADO.NET 1 Data Services use their own network stack to make more request verbs available, but unfortunately this means that cross-domain policies are not applied and you cannot execute cross-domain requests. To get around this, you can either proxy requests or wait for version 1.5 (CTP 2 is available), which supports cross-domain connectivity in Silverlight 3.
References: