什么是WCF RIA服务? [英] What is WCF RIA services?

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

问题描述

我讨厌MSDN的网站WCF RIA服务。它没有说什么,只说,它做什么。它说,它可以实现,但不会说为什么我需要它。

I hate MSDN's site for WCF RIA services. It does not say what it is, it only says what it does. It says what it can achieve but does not say why I need it.

例如:

开发一个$ B $时一个常见的​​问题b n层​​RIA解决方案正在协调中间
层和表现层之间
应用逻辑。

"A common problem when developing an n-tier RIA solution is coordinating application logic between the middle tier and the presentation tier".

嗯,这并不意味着什么给我。

Well, it does not mean much to me.

RIA服务解决了这个问题,通过
。提供的框架组件,工具,
和服务,使服务器上可用的
RIA客户端应用程序
逻辑,而不需要你
手动复制该程序
的逻辑。你可以创建一个RIA客户
是知道的业务规则和
知道客户端是自动
相最新的中间层的逻辑
每个溶液是
重新编译时更新。

"RIA Services solves this problem by providing framework components, tools, and services that make the application logic on the server available to the RIA client without requiring you to manually duplicate that programming logic. You can create a RIA client that is aware of business rules and know that the client is automatically updated with latest middle tier logic every time that the solution is re-compiled."

所以,它从服务器下载的DLL?它是描述为数据规则的元数据?

So does it download DLLs from server? Is it a metadata describing the rules for the data?

那么是什么呢?难道仅仅是一个VS 2010的附加的RAD?或者是它的WCF或下方的顶部或什么技术?它在哪里生活?随着数据与服务器,是什么?

So what is it? Is it just a VS 2010 add-on for RAD? Or is it a technology on top of WCF or underneath it or what? Where does it live? With data, with server, what?

我很感激,如果你能总结一下我吧。

I appreciate if you can summarise this for me please.

推荐答案

RIA服务是一个服务器端的技术,可以自动生成客户端(Silverlight的),该照顾的沟通与服务器为您提供客户端验证。对象

RIA services is a server-side technology that automatically generates client-side (Silverlight) objects that take care of the communication with the server for you and provide client-side validation.

一个RIA服务中的主要对象是的 的DomainService ,通常的 LinqToEntitiesDomainService 连接到一个LinqToEntities模式。

The main object inside a RIA service is a DomainService, usually a LinqToEntitiesDomainService that is connected to a LinqToEntities model.

在RIA服务要记住的关键一点是,它主要是一个复杂的构建把戏。当您创建一个域服务,并编译您的解决方案,为您生成域服务的客户端表示。此客户端表示具有相同的接口。假设您创建一个服务器端领域服务的CustomerService 用的方法的IQueryable<客户> GetCustomersByCountry 。当你建立你的解决方案,为 CustomerContext 叫你的Silverlight项目,有一个方法内部产生的一类 GetCustomersByCountryQuery 。现在,您可以在客户端上使用此方法,如果你是在服务器上调用它。

The key thing to remember in RIA services is that it's mainly a sophisticated build trick. When you create a domain service and compile your solution, a client-side representation of your domain service is generated. This client-side representation has the same interface. Suppose you create a server-side domain service CustomerService with a method IQueryable<Customer> GetCustomersByCountry. When you build your solution, a class is generated inside your Silverlight project called CustomerContext that has a method GetCustomersByCountryQuery. You can now use this method on the client as if you were calling it on the server.

更​​新,插入和删除按照不同的模式。当您创建一个域服务,您可以指示是否要启用编辑。用于更新/插入相应的方法/删除服务器端领域服务,然后生成。但是,客户端侧的部分不具有这些方法。你有你的 CustomerContext 是一个调用方法的SubmitChanges 。那么是如何工作的:

Updates, inserts and deletes follow a different pattern. When you create a domain service, you can indicate whether you want to enable editing. The corresponding methods for update/insert/delete are then generated in the server-side domain service. However, the client-side part doesn't have these methods. What you have on your CustomerContext is a method called SubmitChanges. So how does this work:


  • 更新时,您只需更新现有客户的属性(如果您通过检索 GetCustomersByCountryQuery )。

  • 对于插入,使用 CustomerContext.Customers.Add(新客户(...){...})

  • 对于删除,可以使用 CustomerContext.Customers.Remove(someCustomer)

  • For updates, you simply update properties of existing customers (that you retrieved via GetCustomersByCountryQuery).
  • For inserts, you use CustomerContext.Customers.Add(new Customer(...) {...}).
  • For deletes, you use CustomerContext.Customers.Remove(someCustomer).

当你完成编辑,你叫 CustomerContext.SubmitChanges()

至于验证,可以装饰你的服务器端对象与验证从的 System.ComponentModel.DataAnnotations 命名空间。同样,当你建立你的项目,现在自动对相应的客户端对象生成的验证码。

As for validation, you can decorate your server-side objects with validation attributes from the System.ComponentModel.DataAnnotations namespace. Again, when you build your project, validation code is now automatically generated for the corresponding client-side objects.

我希望这个解释可以帮助你远一点。

I hope this explanation helps you a little further.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆