R – Converting an MVP ASP.NET app to Silverlight 3 – help me choose an architecture

Architecturesilverlight

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.

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.

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!

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.

edit in response to answers so far

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

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

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

second edit

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.

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

I love you all.

Best Answer

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

  • How much you want to reuse of the current solution
  • Whether you want a full screen SL app, or just replace parts of the site with "richer" content
  • How your current app is structured, both visually and what your ActionMethods are returning
  • Timescales

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.

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.

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

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

Related Topic