On September 1, 2011, Silverlight 5 RC was released. As always, RIA Services is included in the Tools for Silverlight, and that release included our V1.0 SP2 RC build. And also as always, we published a standalone installer for RIA Services. You can find it on the download center. The silverlight.net/getstarted/riaservices page will get updated soon to include the link to this build.
This release is one more step toward closing down our SP2 release, and we fixed a number of bugs since SP1. Some notable differences between SP1 and SP2 are:
- DateTimeOffset is supported in SP2
- Support for Silverlight 5 (see below)
- Entity Framework Code-First Support (see below)
- Live IntelliSense is deprecated
- OperationTag was removed
Support for Silverlight 5 (and Silverlight 4)
If you’re using RIA Services SP1, you can target Silverlight 5 with your applications and everything will seem to work. Unfortunately, there’s a small issue that is lurking in your generated code, ready and waiting to cause you bugs. If you look closely at differences between SL4 and SL5 code, you’ll see that there RIA Services SP1 never generates a [RoundtripOriginal] attribute. The omission of this attribute can wreak havoc on your application, and it’s unfortunate that it is silently omitted. With RIA Services SP2, the attribute will return when you are targeting Silverlight 5, and your app will be back to normal.
This issue was introduced because Silverlight 5 changed the runtime and SDK assembly versions from 188.8.131.52 to 184.108.40.206. Deep down in the RIA Services code generation layer, this caused problems where Silverlight assemblies with the 220.127.116.11 version on them could not be loaded. Ultimately, that surfaced as attributes from those assemblies not getting propagated from the server to the client. Because RoundtripOriginalAttribute is defined in a SL4-based assembly, it fails to get generated when targeting Silverlight 5.
We fixed this issue in RIA Services SP2, so if you are targeting Silverlight 5, you must use RIA Services SP2.
In addition to using RIA Services SP2 for Silverlight 5 applications, you can still target Silverlight 4 as well. RIA Services does not depend on Silverlight 5 at all and is in fact still compiled against Silverlight 4 to ensure backward-compatibility.
Entity Framework Code First Support
Support for Entity Framework Code First is provided through either the RIA Services Toolkit, or through the RIAServices.EntityFramework NuGet package. Rather than repeating myself, I’ll just point you to some previous posts on this topic:
- RIA Services EF Code First Support
- WCF RIA Services Toolkit (August 2011) - And Updated NuGet Packages
The difference that you’ll see with the SP2 RC release though is that EF Code First DbContext classes are now respected by the Domain Service Wizard when using “Add New Item… Domain Service.” When you have a valid DbContext class, and you have the Microsoft.ServiceModel.DomainServices.EntityFramework assembly referenced (either from the Toolkit or NuGet), you can now select it from the drop-down and have your Domain Service class stubbed out for you.
For more info on how to use EF Code First with RIA Services, please check out Varun Puranik’s blog. But again, with SP2 RC, you’ll get Domain Service wizard support. Yeah! But don’t forget you need to add the reference to the Toolkit assembly or (preferably) the RIAServices.EntityFramework NuGet package in order for it to light up.
Side by Side Support?
Some people have asked me if RIA Services supports Side-by-Side installations. No, it doesn’t. If you’re targeting Silverlight 4 and you need a Go-Live license, use RIA Services V1.0 SP1. If you’re targeting Silverlight 5 or you don’t need a Go-Live license, then use RIA Services V1.0 SP2.
Something else I wanted to mention regarding side-by-side support is Silverlight 4 and Silverlight 5. There’s an important detail that I don’t know has been communicated properly: When installing Silverlight 5 on your machine, you must keep the Silverlight 4 SDK and Tools installed on your machine. For that matter, you need to keep the Silverlight 3 SDK installed too. If you uninstall any of those things, I promise you pain. Installing Silverlight 5 RC Tools will give you the Silverlight 5 runtime, SDK, and Tools. Your Silverlight 3/4 SDK/Tools will be left in place as these function side-by-side. Your Silverlight runtime will be replaced with SL5, but that won’t interrupt SL4 work.
We are getting close to a final release of SP2. You can expect our final release to be included with Silverlight 5’s final release. We are listening for feedback on the RC though, and we look forward to getting the RTW build in your hands soon!