4

We're starting to develop a new Silverlight LOB application where the DataAccess will not be based on EF, rather our own DAL code (for legacy and other not related reasons).

We are currently debating whether to use RIA Services or simple WCF Services as the Silverlight's facade layer.

The options:

RIA Services and generated code: RIA Services will automagically create proxy classes of our Domain Model and DomainServices in our Silverlight project.
This will mean that our services will need to inherit from the DomainService class, and will require much work and workarounds to allow our custom model to be serialized normally (since we dont use EF)

WCF And shared libraries: We'll create a DomainModel library that will be shared between both Silverlight and our server code (as offered here) giving us more control as to how our domain classes look, and how they are seen on Silverlight, and our services would remain clean as WCF doesnt require us to use any base class and give us much more power over how our services are exposed.

So the question is - given that we dont use EF, what are the pro's to RIA Services, and what are the con's of using WCF and shared domain?

Nilesh Gule
  • 1,511
  • 12
  • 13
sternr
  • 6,216
  • 9
  • 39
  • 63
  • 1
    I can't give you a definitive answer and to be honest this question is somewhat subjective and could be argumentive. I will tell you this which you take or leave as you prefer. Use WCF. Uber "We do all the internal cleverness for you" frameworks like RIA services are the sort of thing that gives massives returns for very little initial investment (your investment will actually be greater since you aren't using EF) but can incur heavy costs later down the road which can sometimes be impossible to recover from. WCF puts you in much greater control. – AnthonyWJones Sep 01 '11 at 13:33
  • That was my thoughts exactly - automagically is abbreviated to automanually in many projects here. From the exponentially increasing articles and examples around MVP's and other evangelists about RIA Services, I'm afraid future versions and tools will have better support and integration with RIA Services whereas WCF will be left behind. Does your answer stands? – sternr Sep 01 '11 at 14:36

1 Answers1

3

I have reasonable real-life experience with both technologies.

The main pros and cons in my perspective:

RIA Services

  • Pro: Development is (much) faster, even without using entity framework. You can create ViewModels, maybe mapping them with AutoMapper, and specify the attributes needed for validation / data entry / relationships. This is good practice even when using entity framework.
  • Con: A lot of overhead.
  • Con: Performance degrades when sending larger amounts of data (something like > 100 objects)

WCF and Shared Libraries

  • Pro: Performance is relatively excellent
  • Con: Development time / maintainability is not as good as RIA Services.
  • Con: Cannot use databinding as well without DomainDataSource (even when using MVVM).

Update For the data-binding part: RIA Services allows for the DomainDataSource control in Silverlight. This enables easy (async) loading with bindable properties for its state (Busy etc.) which makes it easy to do loading animations and general improvements on user experience. This can of course be done without this control, but it helps.

For the RIA services performance, I cannot seem to find the example (someone here said they lost a few months of development time rewriting domain services to conventional WCF services because of the response time that could not be met).

One more note about a Silverlight (Business Application): try zooming your browser in to 110% or 90%, some arbitrary percentage. The fonts / components will get blurred because of way the rendering works. I have confirmed this on multiple machines/configurations and have not found a fix / work around for this. Snapping to device pixels does not help here at all.

Also before you make a decision, it's probably smart to also consider MVC3, with JQuery and HTML5 as an option for your solution. The HTML layout system might not be as good as Silverlight, but there are advantages like cross platform and mobile support.

Bas
  • 26,772
  • 8
  • 53
  • 86
  • +1: I was not aware of the performance degradation on large amounts of data. Good to know. – iCollect.it Ltd Sep 01 '11 at 13:33
  • 1
    Can you clarify that last point "Cannot use databinding as well..."? How come? – AnthonyWJones Sep 01 '11 at 13:33
  • Do you have a reference for info on RIA performance degrading? I'd be curious to see what causes it since RIA and WCF are both WCF. – Derek Beattie Sep 01 '11 at 13:49
  • 1
    Thanks for the input Bas, but could you elaborate on the binding issues with WCF? In regards to the fonts issues, it is a known problem said to be fixed in SL 5 – sternr Sep 01 '11 at 14:32
  • There are no binding issues in WCF, it's just easier to get the data from RIA services – Bas Sep 01 '11 at 14:41
  • Just one other comment. We were put off from using RIA Services due to certain limitations such as no support for duplex communications – Myles J Sep 02 '11 at 08:32