Silverlight 4 Business Application Architecture - silverlight

With the arrival of VS 2010 and Silverlight 4, I decided it's time to look into Silverlight and understand how to build a 3-Tier business application.
After several hours of searching for and reading documentation and tutorials, I'm thoroughly confused (and that doesn't happen easily).
Here are some specific points I don't understand. I welcome guidance on any of them, and also would appreciate any references to a really good tutorial.
Brad Abrahm's What is a .NET RIA services (written for Silverlight 3) seemed very promising, until I realized I don't have System.Web.Ria.dll on my system. Am I missing an optional download? Was this rolled into another DLL for Silverlight 4? Did this go away in favor of something else in Silverlight 4?
This recent blog says to start from a Silverlight Business Application, remove unwanted stuff, create a WCF RIA services Class Library project, and copy files and references from the Business Application to the WCF RIA services project, while manually updating resource references (perhaps bug in B2 compiler). Is this really the right road to go down? It seems... clumsy.
My requirements are to perform very simple CRUD on straightforward business objects.
I'm looking forward to suggestions on how to do that the Silverlight 4 way.

I would say that since the silverlight application will be built on top of ASP.NET, the back-end would be the same for the application whether it was Silverlight or Html (WebForms/MVC)
You could have a look at the CSLA Business Object Framework that includes support for silverlight: http://www.lhotka.net/cslanet/
Not sure 100% if its support Silverlight 4.0 yet, but if its doesnt I am sure it will soon.

To answer your first question, the System.Web.Ria assembly has been replaced by these two assemblies:
System.ServiceModel.DomainServices.Server
System.ServiceModel.DomainServices.Hosting
You can find a list of the breaking changes with the v1.0 release of WCF RIA Services right here.

Related

A good Silverlight 3.0 reference application, with source?

Having never written a production quality Silverlight app, I am looking to find a quality open source reference application for Silverlight 3.0 (Silverlight 4.0 is no good as I have VS2008) to help learn Silverlight.
Ideally I'd like to see:
a line of business application, in the client-server tradition.
SQL Server back end
no use of 3rd party libraries like PRISM or CSLA as I would like to see how the core Silverlight technologies work.
I realise there are plenty of open source projects on Codeplex, but struggled to find any classic line of business apps there.
This is a really good one:
http://timecard.codeplex.com/
The following does use Prism, but you can learn a lot from it. It even shows localization:
http://happynet.codeplex.com/
In all honesty, get yourself upgraded to VS 2010. If you are serious about becoming a professional in Silverlight development, version 4 has the most bang-for-your-buck.
Not all the newer technologies are supported for Silverlight 3 and all the latest cool tutorials and project examples tend to be in VS2010/SL4.
You also should not ignore patterns like MVVM and libraries like Prism & MEF as they are rapidly becoming commonplace for Silverlight projects. There is more danger of you getting into Win-forms-style bad habits if you use a Win-forms style approach to Silverlight at first.
Here is a simple explanation of MVVM for Silverlight:
http://openlightgroup.net/Blog/tabid/58/EntryId/89/Silverlight-View-Model-Style-An-Overly-Simplified-Explanation.aspx
These videos are a good introduction to creating/understanding Prism-based projects, specifically for Silverlight:
http://channel9.msdn.com/posts/mtaulty/Prism--Silverlight-Part-1-Taking-Sketched-Code-Towards-Unity/
It includes him building an Outlook-style application using prism (with full source provided).
The codeplex project, full source and documents etc, for Prism and soon MEF is here:
http://compositewpf.codeplex.com/wikipage?title=Getting%20Started&referringTitle=Home
Prism was created by Microsoft and will soon have a final release of version 4 (including MEF).

Which is the most suitable method for Data Access in Silverlight 3?

We are planning to move to Silverlight 3 for application development because we want to take advantage of more flexible UIs and easier deployment. We have previously used Winforms with ADO.Net and SQL Server for data driven applications.
I've briefly looked at some of the options for data access with silverlight such as Entity Framework and Linq to SQL etc. But due to the pace of Silverlight development by Microsoft I do not know which method is the 'correct' method, and feel slightly overwhelmed by the options.
Can you suggest the best method for data access that I should pursue further reading on? Which methods should be avoided or are obselete?
If possible point me in the direction of a good comparison which I can't seem to find.
The technology that best suits you would be WCF RIA Services around Entity Framework.
Why Silverlight 3? VS2010 + Silverlight 4 is a much more mature platform for this type of Line-of-Business application.
That said, the biggest leap facing you is going from WinForms to Xaml based Silverlight UI.

Silverlight and Line of Business Applications

I'm trying to understand the best way to create line of business applications in Silverlight. I hear about entity framework and RIA Services and prism and I am completely confused. If I want to create a line of business application that pushes data to the the client application, which framework should I use?
Well, Prism in the context of Silverlight is definitely not the Mozilla project mentioned in the other answer. Prism is a Silverlight/WPF framework from Microsoft. The "Overview" paragraph on the following page explains it pretty well:
http://www.codeplex.com/CompositeWPF
I would recommend that you look into RIA services and the MVVM pattern to start with. Rather than Prism (which is a large framework that can seem daunting at first), I would recommend that you check out one of the smaller MVVM frameworks. I use MVVMLight from Laurent Bugnion (Sorry, I tried linking to it but stackoverflow won't let me. Just google it.) and that work fine for my requirements. Once you are comfortable with that you can decide whether you need the power of Prism or not.
/Henrik
You will likely want to use Silverlight + RIA Services. This is really designed exactly for that scenario.
I recommend reading Brad Abram's blog for info, in particular, What is .NET RIA Services?
He also wrote a very long, detailed series about RIA Services.
RIA Services gets data from the LOB application to your Silverlight client (and vice versa).
Entity Framework is the way to get data from your database to your LOB application (and vice versa).
Prism is a project Mozilla has developed that makes a web application look like a desktop application: http://www.riapedia.com/2007/10/26/prism_gives_web_apps_desktop_space
You can user WCF Ria services (very nice and usable data access) and silverlight. Prism is a very nice pattern for architecting modular applications, but I think that it would be an overhead if you want a simple application. MVVM is what you are looking for. MVVM is the design pattern depicting the presentation interacting with the model, but still you could avoid this also, if you want something pretty simple and quick. The learning curve from my pov includes (in order): Silverlight, WCF Ria Services, MVVM, Prism.

Silverlight - Good for Internet Business Application?

I've heard the comment several times, once in one of Shawn Wildermuth's podcasts, that Silverlight is great, but might not be so good for 'entire' internet applications. This comment never get's amplified, but the implication seems to be that you would use Silverlight in conjunction with standard aspx web pages.
So far, the only downside I can see to an all Silverlight application is that the XAP file could get very large, meaning that when a web app is opened, there would be a very noticeable delay.
Most of the apps I do in .NET would be considered small. They are business / CRUD apps of maybe 25 aspx screens along with the supporting cast.
Does anyone have an expanation of the downside of a mostly Silverlight app?
Thanks
Mike Thomas
I'm aware of Shawn's comment, but I think it's a bit dated. If I remember correctly that comment was made before Silverlight could easily handle browser navigation, deep linking and SEO. Those issues are addressed now (largely thanks to RIA services) and Silverlight is a first class web citizen imo. I've done 2 Silverlight only business apps (i.e. the Silverlight content is full screened; there are no ASPX parts to the apps) and have been quite successful with them. A big plus about creating a Silverlight only site is that it's very easy to debug homogeneous content. Take a look at .NET RIA Services if you're seeing holes that need to be plugged when creating a SL business app.
EDIT: RIA Services is Silverlight framework that facilitates development of data oriented Silverlight applications - it's currently in a preview (i.e. not finished) release state but my experience has been that it's stable. WCF is a communications framework used by Silverlight to enable client to server connectivity; it's very similar to traditional web services. RIA Services uses WCF to perform client/server communication. Check out Brad Abram's post "What is RIA Services" for a quick overview here http://blogs.msdn.com/brada/archive/2009/03/19/what-is-net-ria-services.aspx then read his full 25 post series for all the details on RIA Services here http://blogs.msdn.com/brada/archive/2009/08/02/business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update-summary.aspx
If you want to see a complete Silverlight application in action, check out http://www.mediacourtyard.com. They have implemented a complete CMS front-end in Silverlight. Check out the demo, it appears to be fairly stable and functional.
(I have nothing to do with them btw. I trawl the web for Silverlight apps a lot and that CMS is the coolest "full" app I've found so far.)

Is Silverlight RIA worth learning or should I stick to normal Silverlight?

Is Silverlight RIA worth learning or should I stick to normal Silverlight?
Background:
I have done a couple small applications in WPF
I have 12 years expereince with business apps in the VB6/WinForms model
I expect to continue building business applications
My applications will be used internally
While ClickOnce does work for us, we want to get away from locally installed software.
To start with I'm wondering if there might be some confusion going on here.
There's actually no such thing as "Silverlight RIA", so lets clarify some concepts, RIA is commonly defined Rich Internet Applications, Silverlight is one of a number of technologies that can be used to build such applications.
However there's also the Microsoft technology WCF RIA Services, which is what I'm guessing you're referring to. WCF RIA Services were until recently known as .Net RIA Services.
WCF RIA Services (currently in Beta 2) has so far largely been targeted at Silverlight and is even hosted under the silverlight.net domain, which is probably where a lot of the confusion comes from.
However in theory it's not tied to Silverlight at all and is just a technology on top WCF to provide easy data access for RIA type of applications, for a more technical overview have a look at this blogpost by Nikhil Kothari it was written back in March 2009 about .Net RIA Services, so it might be a little out of date but it will give you a good idea on what it's about.
After defining these terms, it's a bit tricky to answer your question "Is Silverlight RIA worth learning or should I stick to normal Silverlight?"
Silverlight is definitely worth learning, by the looks of things Microsoft is going to stick with it. The latest recommendation I heard from someone close to Microsoft, was to go with Silverlight if you can for new LOB (Line Of Business) Apps, if there's something Silverlight can't do, then look to WPF.
Coming from a VB6/Winforms background there will be a bit of a learning curve, but if you've already done a couple WPF apps then you're on good way already.
Silverlight for LOB? Silverlight 3 started bringing in more features related to development of LOB, like for example support for WCF RIA Services. It looks like this is set to continue in Silverlight 4 (due out first half of 2010), with things like support for printing and COM for working with MS Office applications. There's also coming more and more pre-made controls from various 3rd party vendors for many of the standard LOB type of functionality.
So what about WCF RIA Services? It's definitely worth having a look at, it seems to be the preferred way of data access by Microsoft. It provides things like easy access to authentication and data validation. However saying that it's still in beta and there has been some voices raised against it, around the internet so it's probably worth doing some research, before going all in.
Finally, you say that you're applications will be accessed internally but that you don't want the hassle of locally installed software, Silverlight fits that perfectly, just roll out the small Silverlight plugin to your users machines and you're good to go. Any changes needed, just recompile your project and deploy your .xap file to the webserver and it will automatically get pushed out to the users next time they use the app.
Sorry for the somewhat long and rambling answer, I hope it's helped answer your questions :)
Cheers,
Ola
If you are doing business apps then RIA is definitely worth learning. I would recommend you take out an hour and watch this video: .NET RIA Services Intro. In fact you should take 2 hours and work along side this video building the example as you go.

Resources