RIA服务WCF和共享代码 [英] RIA Services Vs. WCF and Shared Code

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

问题描述

我们开始开发一个新的Silverlight LOB应用程序,其中DataAccess不会基于EF,而是我们自己的DAL代码(用于传统的和其他不相关的原因)。

We're starting to develop a new Silverlight LOB application where the DataAccess will not be based on EF, rather our own DAL code (for legacy and other not related reasons).

我们正在争论是否将RIA服务或简单的WCF服务用作Silverlight的外观层。

We are currently debating whether to use RIA Services or simple WCF Services as the Silverlight's facade layer.

选项:

RIA服务和生成的代码: RIA Services将在我们的Silverlight项目中自动创建我们的域模型和域服务的代理类。

这将意味着我们的服务将需要继承DomainService类,并且需要很多工作和解决方法才能使我们的自定义模型正常序列化(因为我们不使用EF)

RIA Services and generated code: RIA Services will automagically create proxy classes of our Domain Model and DomainServices in our Silverlight project.
This will mean that our services will need to inherit from the DomainService class, and will require much work and workarounds to allow our custom model to be serialized normally (since we dont use EF)

WCF和共享库:我们将创建一个将在Silverlight和我们的服务器代码之间共享的DomainModel库( as在这里),让我们更多地控制我们的域类的外观,以及它们在Silverlight上的看法,我们的服务将保持清洁,因为WCF不要求我们使用任何基类,并给我们更多的权力我们的服务是如何暴露的。

WCF And shared libraries: We'll create a DomainModel library that will be shared between both Silverlight and our server code (as offered here) giving us more control as to how our domain classes look, and how they are seen on Silverlight, and our services would remain clean as WCF doesnt require us to use any base class and give us much more power over how our services are exposed.

所以问题是 - 鉴于我们不使用EF,RIA服务的专业版是什么,以及使用WCF和共享域?

So the question is - given that we dont use EF, what are the pro's to RIA Services, and what are the con's of using WCF and shared domain?

推荐答案

我有两种技术的合理的现实生活经验。

I have reasonable real-life experience with both technologies.

我的观点的主要利弊:

RIA服务


  • Pro:即使没有使用实体框架,开发速度更快。您可以创建ViewModel,也可以使用AutoMapper映射它们,并指定验证/数据输入/关系所需的属性。这是一个很好的做法,即使使用实体框架。

  • Con:A lot 的开销。

  • Con:性能下降发送较大量的数据(例如> 100个对象)

  • Pro: Development is (much) faster, even without using entity framework. You can create ViewModels, maybe mapping them with AutoMapper, and specify the attributes needed for validation / data entry / relationships. This is good practice even when using entity framework.
  • Con: A lot of overhead.
  • Con: Performance degrades when sending larger amounts of data (something like > 100 objects)

WCF和共享库


  • Pro:性能相对优秀

  • Con:开发时间/可维护性不如RIA服务。

  • Con:没有DomainDataSource(即使使用MVVM)也不能使用数据绑定。

更新
对于数据绑定部分:RIA Services允许Silverlight中的DomainDataSource控件。这使得它的状态(忙等)能够容易地(异步)加载可绑定的属性,这使得容易地加载动画和对用户体验的一般改进。这可以在没有这种控制的情况下完成,但它有助于。

Update For the data-binding part: RIA Services allows for the DomainDataSource control in Silverlight. This enables easy (async) loading with bindable properties for its state (Busy etc.) which makes it easy to do loading animations and general improvements on user experience. This can of course be done without this control, but it helps.

对于RIA服务性能,我似乎找不到示例(有人在这里说他们失去了几个几个月的开发时间将域服务重写为常规WCF服务,因为无法满足响应时间)。

For the RIA services performance, I cannot seem to find the example (someone here said they lost a few months of development time rewriting domain services to conventional WCF services because of the response time that could not be met).

有关Silverlight(业务应用程序)的一个注意事项:try将浏览器放大到110%或90%,某些任意百分比。由于渲染的工作原理,字体/组件将变得模糊。我已经在多个机器/配置上确认了这一点,并没有找到修复/解决方案。捕捉到设备像素在这里完全没有帮助。

One more note about a Silverlight (Business Application): try zooming your browser in to 110% or 90%, some arbitrary percentage. The fonts / components will get blurred because of way the rendering works. I have confirmed this on multiple machines/configurations and have not found a fix / work around for this. Snapping to device pixels does not help here at all.

在做出决定之前,也可以考虑使用MVC3,使用JQuery和HTML5作为您的选项解。 HTML布局系统可能不如Silverlight那样好,但是有跨平台和移动支持等优点。

Also before you make a decision, it's probably smart to also consider MVC3, with JQuery and HTML5 as an option for your solution. The HTML layout system might not be as good as Silverlight, but there are advantages like cross platform and mobile support.

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

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