20

There are a lot of information how to build Silverlight application using .NET RIA services, but it isn't clear what is unique thing in RIA that is absent in WCF?

Here are few topics that are talking around this topic: [1], [2]

But they doesn't give an answer to the question.

Sorry for the stupid question, but what does RIA Services layer bring into your app if you already have Silverlight <--> WCF Service <--> Business Logic <--> Entity Framework Model <--> Database? Authentication? Validation? Is it relly asset for you?

At the moment the only thing I see: with RIA services usage you don't need to host WCF service manually and don't need to configure any references on the client side (clien side == Silverlight application).

Probably I don't know some very useful features of the RIA Services? So could you please point me to the good doc for that?

Many thanks.

P.S. I've read a lot of different articles about differences, but can't clarify it... all articles "tell around" and aren't concrete. If you are going to give me a link to additional article, could you please be so kind and provide a list of benefits that YOU see.

Community
  • 1
  • 1
Budda
  • 18,015
  • 33
  • 124
  • 206

2 Answers2

12

Actually, you can use the same validation and authentication without using RIA Services. What RIA Services gives you is code generation. It creates your classes for you. You only need to put the business logic. I think RIA Services is very useful for developing small to mid apps very rapidly.

Another difference is that it hides the asynchronous calls to the web service. Many people don't like the async model (which is the only one you can use in Silverlight) and RIA services handles that for you.

I recommend reading this article from Shawn Wildermuth where he points out the pros and cons from both approaches and also includes ADO.NET data services (which is now called WCF Data Services, I think):

http://wildermuth.com/2009/09/29/Choosing_a_Data_Access_Layer_for_Silverlight_3

Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116
Arturo Molina
  • 1,051
  • 11
  • 21
  • Arturo, thank you for the link, it gave some food for thought... but anyway, it is not clear for me what are benefits of RIA. The only new thing I got from the linked article: RIA services are VERY similar to WebServices (or to the WCF that uses WsHttpBasic transfer protocol) and provide additional ability to apply LinQ queries to the called methods. Will they be executed on the server side? Is this all? – Budda Mar 26 '10 at 20:18
  • Yes they will be executed on the server side. RIA Services include filter descriptors that allow you to pass criteria all the way to the DB, which is where they should happen. Other than that and the reasons stated above, yes that is all :-) For me the code generation you get is its difference. – Arturo Molina Mar 31 '10 at 04:45
  • Arturo, how do you replicate the validation logic to the client without duplicating the code? – bob Mar 31 '10 at 10:10
  • You use DataAnnotations on the model. Checkout: http://blogs.msdn.com/brada/archive/2010/03/23/silverlight-4-ria-services-ready-for-business-validating-data.aspx – Arturo Molina Mar 31 '10 at 16:16
  • Thanks for the link, but I work with a regular WCF Service and indeed DataAnnotations on my model (BusinessEntities) (!= DataContracts). And when I read 'Actually, you can use the same validation and auth without using RIA Services...' I thought you had a way to push the validation rules to the client without duplicating code... – bob Apr 01 '10 at 12:09
  • Oh ok, you meant without using RIA Services, sorry about that. I haven't tried that myself this article can help you: http://www.c-sharpcorner.com/uploadfile/dpatra/dataannotationsinsilverlight3application07232009142241pm/dataannotationsinsilverlight3application.aspx – Arturo Molina Apr 01 '10 at 17:17
4

Well, I wouldn't agree with the previous posted answer. WCF Ria Sercices is a great architecture and times have shown proves. I would rather take a look at http://blogs.msdn.com/b/saurabh/archive/2009/11/23/understanding-the-wcf-in-wcf-ria-services.aspx

Actually I use WCF Ria Services on a large LOB application targeting 1500+ contemporary users. I'have done massive use of client code generation customization (see the Varun's blog for details) but I'm able to use LINQ over the wire with silverlight and I have the possibility to choose between automatic lazy or eager loading among the enitities on the context. And please don't forget that the rest paradigm of WCF Ria Services also permits the use of OutputCache.

Not the mention that thanks to custom metadataprovider you can greatly facilitate the generation of the client and how the data are serialized to the client. I believe that if your Silverlight application is Context based you can surely go with WCF Ria Services. Hope this helps, Marco

Hossein Narimani Rad
  • 31,361
  • 18
  • 86
  • 116
mCasamento
  • 1,413
  • 1
  • 11
  • 21