What are the pitfalls of using .NET RIA Services i

2020-06-03 04:22发布

Silverlight can use WCF, Web Services, REST based services, .NET RIA Services, but it seems like Silverlight and .NET RIA Services are preferred most.

I want to know if there are any common issues [which can be a show stopper if one goes ahead with this combo] that you have seen in practical implementation of SL with .NET RIA Services.

Thanks, Rahul

8条回答
Rolldiameter
2楼-- · 2020-06-03 05:18

Working with metadata (and writing it by yourself) is really pain in the ass. Especially when you need to update your model. RIA tutorial applications look quite well on a small database but working with a model consisting of dozens of entites, you'll spend more time updating metadata than programming the application itself. This is also connected with definition of validation and all the validation and description messages on properties from resources. But we have created some T4 templates so it all gets generated automatically.

On the other hand, we're using RIA on two projects and I must say it's the best we can get. We had some troubles with validation but it can be solved (validating before checking whether the property value has changed). And once you are aware of memory management with RIA (you don't want to load the whole databse into memory on client etc.), it can be used in real life.

Unfortunately, there is no silver bullet, so if you, for example, plan other clients than your SL app to connect to the server, you should probably watch somewhere else (WCP Data Services, maybe?). Or if you don't want to update data from your client, I see RIA as overkill.

查看更多
地球回转人心会变
3楼-- · 2020-06-03 05:18

FOLLOWING MY PREVIOUS ANSWER HERE THE DISADVANTAGES OF RIA SERVICES: On the other end the disadvantage of ria services is its lack of flexibility. Mainly it is like a tube that connect a class on the server side with its client side representative in such a way you operate on the client side class like you were operating directly on the server side class. If the way this "tube" his handled is ok for your application, you get a lot of services fro free (without writing any code...). However, there are limitations that one cannot remove specifically:

1) You have not the same freedom in defining behavior, attribute etc. to modify the way the Web service behaves. For instance you cannot define a distributed transaction involving more than one web service. It is difficult to add new endpoints....You have to write code....not simply modifying a configuration file.

2) You can only define one Insert/one update/one get methods for each class. If you apply filtering to the client side query via LINQ it is applied only on the client, i.e. all data are downloaded from server and then filtered on the client. On the contrary if you use a WCF data services based on OData and you define a query on the client side. THIS QUERY IS TRANSLATED INTO A REST QUERY (a query encoded in the URL of the request) THEREFORE ONLY THE DATA YOU REQUIRE WITH YOUR FILTER ARE ACTUALLY DOWNLOADED FROM THE SERVER. For more information on WCF data service see here.

3) By contrast with WCF Data Services you have no Validation service offered as with Ria service. However you can continue using data annotatios with the help of my Validation Toolkit for WPF & Silverlight, that is available for free here

查看更多
登录 后发表回答