Silverlight 4 WCF or RIA services
I'm very new to silverlight and I'm thikning which way to go. I'm in planning phase of my new project which should be built on silverlight. The problem is that I want to have my own DAL -> BLL on server side, and WCF service, which will talk to Silverlight should be consumable by other applications too, including other technologies such as Java. I know that in 4 release MS presented RIA services to handle 开发者_Python百科business logic tasks and EF for data handling, but I don't want to use EF at all. So do you have any suggestions what's the cons and pros of choosing either ways? Does RIA service has some cons when working with silverlight app than standard WCF service? How about portability? consuming it from java for example?
Thanks
RIA Services are a layer that sits on top of WCF. It is designed to enable advanced usages with EF or LINQ to SQL. You can also mix in your own custom WCF services, and you can use RIA with your own custom logic, data/entity mechanisms, and your custom DTOs as well (you will lose most of the advantages RIA offers though).
The key thing about RIA Services is that it allows automation of LINQ query execution and auto-generates some very advanced proxy classes on the client. This allows the client to work with the RIA Services as if the query execution was local on the client, but have those queries actually execute on the server. The drawback to RIA Services is that it's mostly a MS only technology (in this version at least). In theory you can talk to RIA from a java client, but you'd gain almost no advantage that way; you'd be best advised to just build your server services with WCF manually if you are going to support other clients.
One exception is that RIA can generate oData endpoints. That might be useful in non-MS client scenarios, but only if oData is appropriate in your case. RIA Services are VERY new though, so I'd wait for the next version before trying to use it for non-silverlight clients.
RIA Services are not tied to Entity Framework. You could use just any data access technology you want and expose it as RIA service. An advantage of RIA services over plain WCF is that it simplifies much of the necessary plumbing.
精彩评论