本文介绍了RIA 服务与 WCF 服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在重写一个 LOB 应用程序,其架构如下:

I'm rewriting an LOB application whose architecture is like this:

银光&&Windows Mobile -> WCF-> 实体框架 -> 数据库.

移动应用程序应该能够像 Silverlight 应用程序一样执行某些操作.在这里使用 RIA 服务有什么好处?RIA 服务相对于 WCF 的优缺点是什么?

The mobile app was supposed to be able to do certain things as the silverlight app. What benefits would I get from using RIA Services here? Whats the advantage and disadvantage of RIA Services over WCF?

推荐答案

.NET RIA 服务是为在浏览器中运行的 Silverlight 创建的.Silverlight 正在运行 .NET 框架的特殊版本,并且在 N 层应用程序中 Silverlight 无法与服务器端共享程序集.通过使用一些巧妙的代码生成,.NET RIA 服务使开发人员几乎看不到这一差距.类似于领域类的类是在客户端生成的代码,并且还提供了在客户端和服务器之间来回移动对象的方法.

.NET RIA Services was created for Silverlight that runs in the browser. Silverlight is running a special version of the the .NET framework and in an N-tier application Silverlight is unable to share assemblies with the server side. By employing some clever code generation .NET RIA Services makes this gap almost invisible to the developer. Classes similar to the domain classes are code generated on the client side, and ways to move objects back and forth between client and server are also made available.

您可能能够从 Windows Mobile 调用 .NET RIA 服务,但我认为这不会特别容易,目前您实际上可能必须对线路上发送的内容进行逆向工程(使用 JSON).另一方面,WCF 的范围要广泛得多,但不像 .NET RIA 服务那样支持 Silverlight 开发.

You will probably be able to call into a .NET RIA Service from Windows Mobile, but I don't think it will particular easy and currently you may in fact have to reverse engineer what's sent on the wire (JSON is used). WCF on the other has a much more broad scope, but doesn't support Silverlight development in the same way that .NET RIA Services does.

如果您正在编写只有 Silverlight 的 N 层应用程序,那么 .NET RIA 服务非常强大.然而,如果 Silverlight 只是几个客户端之一,WCF 可能是更好的选择.

If you are writing a Silverlight only N-tier application .NET RIA Services are very powerful. If however Silverlight is only one of several clients WCF is probably a better choice.

请注意,.NET RIA 服务尚未发布,但可以下载预览版.

Please note the .NET RIA Services hasn't been released yet, but a preview is available for download.

这篇关于RIA 服务与 WCF 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 23:28