My Silverlight 2 Data Services Article Code Updated

Silverlight Logo

I've uploaded a new version of my code from my Silverlight 2/Data Services MSDN Article. I took the new Silverlight 2 Data Services client that was released and updated the code example. If you want to get the code, you can download it from my site here:

http://wildermuth.com/downloads/sl2_ds_example.zip

I've also changed and updated the examples (more elaborate versions of the article code) using it on the Silverlight Data site, including both the Entity Framework and the NHibernate examples.  Let me know if find any bugs.

Comments:

Thanks for the code sample. Using the Entity Framework seems much more elegant than other ways of writing data back from Silverlight that I've found.

I'm getting an error in the ProductList.OnLoadComplete method. When calling ProductQuery.EndExecute you get the error: "The closed type System.String does not have a corresponding Category settable property."

I think I have found the answer - on Tim Heuer's blog you entered: "Be aware even though the .NET SP1 includes ADO.NET Data Services, it is not compatible with the Silverlight 2 Beta 2 runtime. I've been told it will be compatible as of RTM of Silverlight 2, so as long as you aren't use Data Services with Silverlight 2, this new installation should work fine."

Thats disappointing. I really wanted to get rolling with SL + EF.

Shawn (if that is your real name ;),

Actually, the Data team just released a new Silverlight 2 Client Library for Data Services that is supposed to fix the compability issues:

http://wildermuth.com/2008/09/02/New_Build_of_Silverlight_Library_for_Data_Services!

It was my real name and thanks!

Thank you for this NHibernate example. Why did you use ADO.NET Data Services? Is it because you are using nhibernate.linq and not a simple string hql? Can NHibernate be used with a simple web service call and string hql?

System.Data.Services.EntitySetRights' does not contain a definition for 'WriteUpdate'

Error on MSDN load

Frank,

Yes, as stated before the article was written again .NET 3.5 SP1 *BETA*. That's why I included a link to an updated example you can download.

Dan,

Read the article to understand the why of Data Services. Its not a replacement for simple Web Services, but right for certain use cases.

I read this Using Microsoft ADO.NET Data Services and your article I found. As I understand, using Microsoft ADO.NET Data Services is just an option you can take in implementing data access (and data manipulation) in silverlight client (and you can only do it with NHibernate.Linq implementation). But you can still use a simple web services and a normal for example grid binding (and string hql data retrieval) as in ajax web applications. Did I understand it correctly? Why am I asking this. Cause I have rather complicated hql sentences and there is no way I can convert them to Linq sintax. So I must decide to drop this silverlight and simply use ajax web application if normal NHibernate usage is not possible.

Dan,

If you are using complex HQL, just use a web service (though if you're passing HQL, be careful of injection attacks). Data Services is a way to expose your data without hand-writing all your CRUD, but if you already have it in HQL, go for it. No reason to use Data Services in that case.

I updated the system.Data.services.Client from ADO.NET Data Services Silverlight 2 B2 Client Refresh and your sample is still throwing


Expected an absolute, well formed http URL without a query or fragment.

Sorry I failed to mentioned that it was failing on the :
public NorthwindEntities(global::System.Uri serviceRoot) :
base(serviceRoot)

I'm writing to determine if there are Silverlight tutorials available for accessing data with Oracle.

Thanks, Rob

Robert ... I am not aware of any Oracle specific example s from Silverlight 2, but the concepts in Shawn's article are the same. If you use Entity Framework to talk to Oracle (which is fine since EF talks to any DB providers) the rest of Shawn;s code will work fine. If you want to skip EF and use NHIbernate or simply write your own DAL, that works too.

But an example against Oracle is probably a good idea, just to make it simpler for people.

Error 1 'System.Data.Services.Client.OperationResponse' does not contain a definition for 'Error' and no extension method 'Error' accepting a first argument of type 'System.Data.Services.Client.OperationResponse' could be found (are you missing a using directive or an assembly reference?) C:\labroot\labs\ADO\Refresh\shawn\blog1\Example\CS\SL20DSExample\SL20DSExample\ProductList.cs 121 26 SL20DSExample

This solution is not working with Silverlight 2 RC0

In order to make it work:

- In Page.xalm change
xmlns:ext="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended"
to
xmlns:ext="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
(This is because the extended controls are now part of the System.Windows.Controls)

- In Page.xalm remove the Mode=TwoWay, for the "productSelector" Listbox. (If we include the TwoWay now it will needs the Path property too.)


 



 
Save Cancel