Silverlight 4 WCF或RIA服务

时间:2021-08-03 03:14:10

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 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?

我对Silverlight非常陌生,而且我想要走哪条路。我正在计划我的新项目的阶段,应该建立在silverlight上。问题是我希望在服务器端拥有自己的DAL - > BLL,并且与Silverlight通信的WCF服务也应该被其他应用程序使用,包括其他技术,如Java。我知道在4版本中MS提供了RIA服务来处理业务逻辑任务和EF用于数据处理,但我根本不想使用EF。所以你有什么建议选择两种方式的缺点和优点吗?使用Silverlight应用程序时,RIA服务是否有一些缺点,而不是标准的WCF服务?便携性怎么样?例如从java消费它?

Thanks

2 个解决方案

#1


1  

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).

RIA Services是位于WCF之上的一个层。它旨在通过EF或LINQ to SQL实现高级用法。您还可以混合使用自己的自定义WCF服务,并且可以将RIA与您自己的自定义逻辑,数据/实体机制以及您的自定义DTO一起使用(您将失去RIA提供的大部分优势)。

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.

RIA Services的关键在于它允许自动执行LINQ查询并在客户端自动生成一些非常高级的代理类。这允许客户端使用RIA服务,就好像查询执行在客户端上是本地的,但是这些查询实际上是在服务器上执行的。 RIA Services的缺点是它主要是MS技术(至少在这个版本中)。从理论上讲,你可以从一个java客户端与RIA交谈,但你几乎没有任何优势;如果您要支持其他客户端,最好建议您手动使用WCF构建服务器服务。

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可以生成oData端点。这可能在非MS客户端方案中很有用,但前提是oData适合您的情况。 RIA服务非常新,所以在尝试将其用于非Silverlight客户端之前,我会等待下一个版本。

#2


0  

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.

RIA服务与实体框架无关。您可以使用您想要的任何数据访问技术并将其公开为RIA服务。与普通WCF相比,RIA服务的一个优点是它简化了大部分必要的管道。

#1


1  

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).

RIA Services是位于WCF之上的一个层。它旨在通过EF或LINQ to SQL实现高级用法。您还可以混合使用自己的自定义WCF服务,并且可以将RIA与您自己的自定义逻辑,数据/实体机制以及您的自定义DTO一起使用(您将失去RIA提供的大部分优势)。

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.

RIA Services的关键在于它允许自动执行LINQ查询并在客户端自动生成一些非常高级的代理类。这允许客户端使用RIA服务,就好像查询执行在客户端上是本地的,但是这些查询实际上是在服务器上执行的。 RIA Services的缺点是它主要是MS技术(至少在这个版本中)。从理论上讲,你可以从一个java客户端与RIA交谈,但你几乎没有任何优势;如果您要支持其他客户端,最好建议您手动使用WCF构建服务器服务。

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可以生成oData端点。这可能在非MS客户端方案中很有用,但前提是oData适合您的情况。 RIA服务非常新,所以在尝试将其用于非Silverlight客户端之前,我会等待下一个版本。

#2


0  

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.

RIA服务与实体框架无关。您可以使用您想要的任何数据访问技术并将其公开为RIA服务。与普通WCF相比,RIA服务的一个优点是它简化了大部分必要的管道。