Ranting and raving about anything I feel like complaining about.

State of Data Access in Silverlight 4

Url: http://wildermuth.com/2010/02/21/The_State_of_D...

Silverlight Logo

Back in February I wrote an article stating my opinion about the current State of Data Access in Silverlight (then Silverlight 3 and betas of WCF RIA Services and WCF Data Services). Things have improved in some ways since then but they haven't been fixed.  Here's my thoughts on the current state:

The three options for data access are still the same "Web Services, WCF Data Services and WCF RIA Services". My major issue with data access today in Silverlight persists: there is no perfect answer. There is give and take with each approach and giving good advice about the right one is difficult.  Instead of talking about the right way to do it, let's look at a chart i've been coming up with to simplify it:

 Silverlight Data Access Chart

(Click to enlarge)

This chart should represent the pros and cons I see with all the technologies.  Hopefully this helps you make the decision for your projects.

 
 

Comments

Gravatar Hi,
Respectfully, I believe that for WCF Data Services it should be 'Server side sorting, filtering, paging and projections support' as a pro. Not just 'paging'.
Gravatar Shawn,
Thanks for this, it's very useful.

-Damien
Gravatar So Shawn, given those 3, what are you using on your line of business Silverlight 4 apps ?
Gravatar WCF RIA Services supports eager loading. You have to use [Include] attributes on metadata + Include methods in domain service methods .
Gravatar Any thoughts on which one works best in partnership with MVVM ?
Gravatar What about REST services with JSON/POX?
Gravatar Przemek Soszynski,

Do you mean WCF Web Services?
Gravatar Steve,

It depends...

Its a bad answer but that's the fact. I tend to lean towards WCF Data Services because I like the caller being able to control the query, but that doesn't work in harded security situations.
Gravatar Anon,

That's support for eager loading in the model, not in the query. I can't do eager loading on a query by query or operation by operation basis.
Gravatar Jim,

Because you typically hide the data access in the Model, you can do all three equally well in MVVM.
Gravatar Eric,

I don't see that as a common scenario as you are doing weakly typed results. You can do it and its similar to the Web Services story, but there are no benefits beyond what you see in Web Services for REST POX/JSON except perhaps message size, but binary encoding message bodies in Web Services + GZip means size is really similar.
Gravatar I would have split up the WCF services into SOAP/ASMX and REST based implementations. Consuming them is different between the pattern you select. In fact, REST based services don't even need to be WCF.

BTW...do you know if batching is supported in WCF RIA Services? I know in WCF Data Services...batching can be turned on.
Gravatar @Shawn. I mean WCF Data Services with OData. I have been using it for some time now. I am able to do paging, sorting and filtering on server. The linq queries are translated into url and executed on the server. Sorted, paged data comes back to the client.
Gravatar Przemek Soszynski,

That's exactly what I mean by client-side paging, filtering, sorting and projections. They are defined on the client, performed by the server.
Gravatar Bart,

WCF RIA Services can batch changes to the server. They just can't batch SELECTs.

I understand why you'd want to separate them, but I don't think the use-case for REST being large enough for Silverlight specifically to divide it up, but its a good comment.
Gravatar I agree with everything you've said here.

I've been going the web services (WCF) route with my Silverlight 4 projects. Fortunately, most of my projects thus far haven't had to deal with any data versioning or change tracking.

Also, using some open source projects like AutoMapper and FluentValidation relieves some of the efforts related to code bloat and manual validation.
Gravatar Are you only reviewing solutions provided by Microsoft? Would it be worth mentioning 3rd party open source and/or commercial options? Have you looked into IdeaBlade's DevForce for Silverlight?
Gravatar Bobby,

I am open to open source/commercial options I just haven't had time to look at them. I've talked to Ward Bell (of Idea Blade) about it at length and I think it might be a viable solution but as I haven't dedicated time to review it I can't speak to it.
Gravatar Shawn,
RIA Services already support server-driven paging; e.g. adding the following attrib to a query method in a DomainService causes results to be capped at 100 objects - all enforced on server.
[Query(ResultLimit=100)]

The end-to-end manifestation is more suitable for RIA scenarios rather than a wide open service but the goal is the same. Server decided how many results to send. The client can choose fewer but will not get more. This can be added to the OData endpoint of DomainService as well in future.
Gravatar Thanks Dinesh, I didn't know. Are there any solutions like Continuations with the result limits?
Gravatar I would like to say that I have been using DevForce 2010 / by IdeaBlade and it is by far the best current solution for Silverlight Data access. Their approach is light years ahead of everything else at the moment; of course this can change when “Monkey Coder “is released. The Silverlight piece is under a grand and they have a free D/L for developers to learn the tool. Check it out.
Gravatar Hi..
and how do you comapare thouse technologies with Ideablade Devforce 2010??

Thanks
Gravatar Hi Shawn,

I've tested both, and was disappointed by both. I don't think it is possible to built a professionnal product with those (without writing your own heavy business wrapper).

Finally I tested and adopted CSLA for silverlight. Hard to learn but really powerfull. My project is still under development, but I believe that I won't come back from it...

Did someone test it? Any experiences? Why doesn't it have a larger audience?

Christophe
Gravatar Christophe,

I haven't spent a lot of time in CSLA for SL (I've reviewed it for desktop development in the past). I've heard good things, but the ramp is steep. For a large application I could see the benefit.
Gravatar Hi Shawn,
in Cons for Web Services you have "manual change tracking". What about Entity Framework self-tracking entities with WCF?
Gravatar I don't believe self-tracking entities will track in Silverlight (only on the server side) but if I am wrong, let me know.
Gravatar Self-tracking entities can track changes in any tier and provide an easy way to move sets of entities with changes between Silverlight applications and .NET services. Here is a walkthrough from the product team: http://blogs.msdn.com/b/adonet/archive/2010/05/14/self-tracking-entities-in-silverlight.aspx
Gravatar Good info, i'll look into this and thanks. The advice is still similar though as not every app can use STE's or even EF.

Add a Comment

*
*
*