将 MVP ASP.NET 应用程序转换为 Silverlight 3 - 帮我选择架构 [英] Converting an MVP ASP.NET app to Silverlight 3 - help me choose an architecture

查看:21
本文介绍了将 MVP ASP.NET 应用程序转换为 Silverlight 3 - 帮我选择架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人要求我将 MVP ASP.NET 应用程序转换为 Silverlight.这将是我的第一个 Silverlight 应用程序,我正在努力确定如何最好地组织架构.

I've been given the ask of converting an MVP ASP.NET app to Silverlight. This will be my first Silverlight application and I'm struggling to determine how best to organise the architecture.

该应用程序是非常标准的 CRUD LOB 应用程序.我还将使用 GIS 组件,但我认为这不会对一般架构产生影响(如果有请纠正我).我将使用 Subsonic 作为 DAL,但我再次认为这不会对我的架构产生影响.

The app is very much a standard CRUD LOB app. I will also be using a GIS component but I dont think this makes a difference to the general architecture (please correct me if it does). I'll be using Subsonic as the DAL, but again I dont think this makes a difference to my architecture.

原始应用程序相当大,所以如果可能的话,我想尽可能多地重用模型和视图.

The original application is rather large, so if possible I would like to reuse as much of the model and the view as possible.

在网络上四处阅读,对于 Silverlight 3 LOB 应用程序架构的最佳实践"是什么有点令人困惑.微软似乎正在推动这个 RIA 框架——但它只是预览版......它准备好生产了吗?我的印象是 Microsoft 正在通过 Silverlight 3 推动不同的架构指南,但我正在努力找出这些架构到底是什么!

Reading around on the web its a little confusing as to what is considered 'best practices' for the architecture of Silverlight 3 LOB apps. Microsoft seems to be pushing this RIA framework - but its only in preview...is it production ready? I get the impression that Microsoft are pushing different architectural guidelines with Silverlight 3, but I'm struggling to find out what exactly these architectures are!

还有 Prism 和 Caliburn 项目.

There is also Prism, and the Caliburn project.

幸运的是,我在这里有一个非常灵活的截止日期,所以我想尽可能接近最佳实践,即使这在开始时意味着一些学习曲线.

Luckliy I have a very flexible deadline here, so I'd like to get as close to best practices even if it means a bit of a learning curve at the beginning.

我将不胜感激朝正确方向的友好推动.

I would greatly appreciate a friendly nudge in the right direction.

根据目前的答案进行编辑

  • 解决方案将是 100% 全屏 Silverlight 应用程序.我对混合 Silverlight-Asp.net 前端不感兴趣.

  • The solution will be a 100% fullscreen Silverlight app. I am not interested in a mixed Silverlight-Asp.net frontend.

考虑到这一点 - 我希望最大限度地重用模型并查看代码库的一部分,但前提是在不为新架构做出重大牺牲的情况下这是可能的.

With this in mind - I want to maximise the reuse of the model and view part of the codebase, but only if this is possible without making major sacrifices to the new architecture.

解决方案需要来自 Microsoft 或至少得到很好的支持.

The solution needs to come from Microsoft or at least be very well supported.

如果 RIA 可能在发布前更改,则完全没有争议.

If RIA is liable to change before release, its totally out of contention.

第二次编辑

感谢大家的精彩回答.我给每个人都投了赞成票,但答案必须交给史蒂夫,因为他的回答实际上是我应该问自己的一系列问题.

Thanks everyone for their excellent answers. I've upvoted everyone but the answer has to go to Steve because his answer was actually the series of questions I should have been asking myself.

我会在仔细查看 Prism 和 CSLA 后更新线程.

I'll update the thread once I've had a good look at both Prism and CSLA.

我爱你们所有人.

推荐答案

这么多选项 :-) 您的选择可能取决于几个因素:

So many options :-) Your choice probably depends on several factors:

  • 您希望重复使用当前解决方案的程度
  • 您是否想要全屏 SL 应用程序,或者只是用更丰富"的内容替换网站的某些部分
  • 您当前应用的结构,包括视觉效果和 ActionMethod 返回的内容
  • 时间表

RIA 服务可能是一个不错的选择,因为它至少可以让您重用您的模型和验证(如果您使用数据注释),但它还有一段路要走,并且可能会在发布之前发生变化.

RIA services might be a decent fit, as it would allow you to at least reuse your model and validation (if you're using data annotations) but it's some way off and likely to change before release.

另一个选项是全新的 Silverlight 应用程序,为此我建议您查看 PRISM 和 MVVM 来构建它(如果只是为了保持初始有效载荷!).您可能可以重用您的模型,并且 Silverlight 中支持数据注释,但您不会重新创建一个新应用程序.

The other option is a ground up Silverlight app, for which I'd recommend taking a look at PRISM and MVVM for structuring it (if only to keep the initial payload down!). You could probably reuse your model, and there is support for data annotations in Silverlight, but you wouldn't be far off recreating a new application.

第三个选项,您可能喜欢或讨厌,是在 SL 中为您站点的区域构建具有丰富功能的孤岛".您可以使用现有的 MVC 应用程序,并可能让 ActionMethods 返回 JSON(或 XML,如果您愿意),您的 SL 区域可以使用和呈现该 JSON.您可以重用体面的代码,并且可以单独增强网站的各个区域.

The third option, and one that you may love or hate, would be to build "islands" of rich functionality in SL for areas of your site. You could use your existing MVC app and potentially have ActionMethods return JSON (or XML if you'd prefer) which your SL areas could consume and render. You'd have decent code re-use and you could enhance areas of the site in isolation.

对开放式问题的开放式答案:-)

An open ended answer to an open ended question :-)

编辑:根据您的回答判断,如果是我,我会创建一个 PRISM 应用程序.如果它当前是一个 Web 应用程序,它应该与区域模型配合得很好"(尽管您实际上不会重用任何视图代码),如果您想要一个全屏应用程序,动态 XAP 加载将​​有助于您的初始有效负载.如果它是基于 CRUD 的应用程序,那么您可能需要查看 XAML Power Toys 可快速将数据表单组合在一起.

EDIT: Judging by your responses, if it were me, I'd be creating a PRISM app. If it's currently a web app it should "sit" quite well with the region model (although you wouldn't be actually reusing any view code), and the dynamic XAP loading will help with your initial payload if you want a single full screen app. If it's a CRUD based app then you might want to take a look at the XAML Power Toys to quickly put data forms together.

Datawise 你可以重用你的模型并通过 WCF 或 ADO.Net 数据服务公开它,等待 RIA 服务稳定(取决于你的时间尺度)或仍然使用 MVC 操作方法但从它们返回 JSON 用于 SL 应用程序消费.

Datawise you could either reuse your model and expose it via WCF or ADO.Net Data Services, wait for RIA services to stabilise (depending on your timescales) or still use the MVC action methods but return JSON from them for the SL app to consume.

这篇关于将 MVP ASP.NET 应用程序转换为 Silverlight 3 - 帮我选择架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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