Silverlight 3 – Simple consumption of a WCF Service
Last night we were *supposed* to watch Monsters vs. Aliens but unfortunately those plans went out the window once I realized I was missing a credit card. I managed to find it eventually but since we had missed the movie I figured I’d spend some time playing around with Silverlight 3 and WCF to see if there were any big changes in the beta (other than the obvious new RIA Services). I’ve used WCF in past silverlight projects and for the most part there were no real changes in Silverlight 3. A quick rundown of the steps involved:
- Add a new Silverlight project
- Add a new Linq to Sql class (Add New Item – Linq to Sql Classes) and add a table from an existing database to the designer (e.g. Orders from Northwind)
- Add a new WCF Service to the web project and modify your service implemntation to return a list of orders. (Add New Item – WCF Service). Note that this is a standard WCF service and not a Silverlight-enabled WCF Service.
- Modify the endpoint element in your web.config so that it used basicHttpBinding instead of wsHttpBinding (Silverlight only supports basic binding)
- Add a datagrid to your MainPage.xaml
- Add a Service Reference to the Silverlight project for brevity’s sake. Ensure the ServiceReferences.ClientConfig has the proper values for the endpoint (especially the address and contract attributes). David Betz has a good overview of WCF and assembly reuse in Silverlight.
- Modify the MainPage.xaml.cs to load the appropriate data on the load event. For example:
Getting started with Silverlight 3 – Hello Bouncing Ball
I’ve been playing with Silverlight 3 lately and thought I’d post a quick guide on getting started. Note that once installed you can only develop silverlight 3 applications since VS doesn’t support multi-targeting for Silverlight apps.
Also, in order to start the initial install you’ll have to uninstall any previous betas of Blend you may have installed. I had Expression Blend 2.5 installed and received this: Beta and preview versions of Microsoft Expression Blend must be uninstalled before installation can continue. Don’t worry about Silverlight 2, it will automatically uninstall Silverlight 2 for you. All of the links below are available at http://silverlight.net/getstarted/silverlight3/default.aspx, I’ve just added direct links to the files.
- Download and install Silverlight 3 Tools (which will also install the SDK and runtime) : Silverlight 3 Toolkit March 2009.msi. Installs to C:Program FilesMicrosoft Silverlight
- Download and install Expression Blend 3 Preview : Blend_Trial_en.exe. Installs to Installs to C:Program FilesMicrosoft Expression
- Download and install the Silverlight 3 Toolkit : Silverlight3_Tools.exe. Installs to C:Program FilesMicrosoft SDKsSilverlightv3.0ToolkitMarch 2009
- Download and install .NET RIA Services preview : RiaServices.msi. Installs to C:Program FilesMicrosoft SDKsRIA Services
Siverlight 3 Videos : http://silverlight.net/learn/videocat.aspx?cat=12#sl3
Silverlight 3 Labs : http://silverlight.net/learn/labs.aspx
Big news day from Mix 09
Lots of news coming out of Mix 09….
ASP.NET MVC Released
Scott Guthrie recently posted a great (and free) tutorial from his upcoming book here. Not a whole lot of changes from RC2, but you’ll have to uninstall previous versions obviously. You can get the installer here. Note that some addins can cause problems during the install (notably Azure tools), but there’s a hotfix available for it.
Silverlight
Silverlight 3 beta announced : Getting started with Silverlight 3. Tim Heuer has a pretty detailed post regarding the new featuresLooks like there’s a ton of features in the works, new codecs (H.264, AAC,MPEG-4), improved graphics support (3D transform effects). hardware acceleration, and even standalone silverlight apps. Interestingly the download for the silverlight 3 install is smaller than the current silverlight 2 install.

