RIA Services, Silverlight

Upgrading from .NET RIA Services to WCF RIA Services

I just had to go through the process of upgrading an app built with the RIA Services CTP code from a few months ago to the new WCF Ria Services beta that was released at PDC.

After the upgrade I was presented with a billion errors – I had one of those “OMG I wish I didn’t just do that” moments… but after some hunting around I found that the changes were not too bad.

Here is my report on what I did to get my project working.

In web project

I had a custom object being exposed via RIA Services, which meant I had to have a [Key] attribute on one of the properties. System.ComponentModel.DataAnnotations has been upgraded, but the reference in your project will have required specific version set. So remove the missing DLL and re-add it. Use the 3.6.0.0 version.

System.Web.DomainServices.Providers has been split in to two files – System.Web.DomainServices.LinqToSql and System.Web.DomainServices.EntityFramework. I’m using LinqToSqlClasses in my project, so I added the Linq version (and removed the old reference).

You’ll also have to update the name spaces in your DomainServices – Change “using System.Web.DomainServices.Linq;” to “using System.Web.DomainServices.Providers;”.

ServiceOperation has changed to Invoke.
Please note that it seems that in the VS2010 version of WCF Ria Services you can return entities from Invoke operations but not in the VS2008 version. Keep this in mind when you are designing your domain services – although you probably should use normal non Invoke style methods to return entities.

Also in your domain services on the server, “this.Context” has been changed to “this.DataContext”.

I had an enum that was exposed by a ServiceOperation (now Invoke) and it wasn’t being properly pushed out the client code. This appears to have been fixed, so I removed the .shared part of the file name to fix (it was doubling up on the client and getting a compiler error).

Silverlight Client

SubmitOperation is now in System.Windows.Ria namespace, not System.Windows.Ria.Data

If you are using RiaContext to get login information etc, then you’ll have to change RiaContextBase to WebContextBase.

IEditableCollection is gone… I use PagedCollectionViews mostly anyway (which use IEditableCollectionView) – IEditableCollection was in the SL3 Beta (but removed for RTW), and seemed to be included *again* in the older RIA Services stuff – but it’s gone again 🙂

ServiceContract() (which is in the auto generated files on the client) is now in System.ServiceModel.dll (so add it as a reference).

MergeOption has been changed to LoadBehavior with new options – KeepCurrent, MergeIntoCurrent and RefreshCurrent (much nicer!)

That’s all I had to do to get the app compiling, but at runtime I had a few problems with the RIA services requests getting 404. I fixed this by adding a temp domain service to the app – which updated the Web.Config for me…

It Added the following httpModule:

<add name="DomainServiceModule" type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

It Added the following module:

<add name="DomainServiceModule" preCondition="managedHandler"
    type="System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

It also added some WCF stuff right down the bottom of the file:

<system.serviceModel>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
 </system.serviceModel>

Hope this helps you upgrade your projects!

10 thoughts on “Upgrading from .NET RIA Services to WCF RIA Services

  1. I too had the “OMG, what the..” moment when I moved to WCF RIA. Thanks a ton for this. Truly saved me a lot of time.

  2. Thank You very much. I doesn’t find any document to describe these changes. Really It helps me a lot.

  3. And evaluate rates, suppression of the?Credit crunch that, The shorter the.Daunting task as, optimize it Onsite.Travel agent You Archives, each bag as truth of the.Practice to give, Mitte die.,

  4. Market with prices, you only?Marketer is the, end of that.The page Everyone, connection speed of.Different clubs in poker, identity Identity theft comes from an.That readers need, against yourself by.,

  5. Pingback: accident

Comments are closed.