Data Access has been discontinued. Please refer to this page for more information.

How to: Convert WCF RIA Services

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

Suppose, you have a Domain Class (WCF RIA Service) exposing your Entity Framework data model. After the migration, the original Domain Class cannot be used with the converted domain model. You have to generate a new WCF RIA Service with same name by using the Telerik Data Access Domain Service template.

For example, consider the following sample web application that contains a Domain Class named "DomainService".

The DomainService class inherits from LinqToEntitiesDomainService<EFDataModel>. The problem is that the generic LinqToEntitiesDomainService<T> expects only classes that derive from ObjectContext. The OpenAccessContext has a different base class and cannot be used with the standard LinqToEntitiesDomainService<T> class. Fortunately, Telerik Data Access exposes its own WCF RIA provider. You have to generate a new WCF RIA Service with same name by using the Telerik Data Access Domain Service template.

The next step is to exclude (delete) the original DomainService.cs file from your project. Or, if you haven't completely migrated your WCF RIA Service, you could just comment the code for the service.

Adding Custom Domain Service Logic

If your original DomainService class contains any custom query methods, you need to transfer (copy+paste) them in the new Telerik Data Access Domain Service. However, as described in the How to: Extend Domain Service topic, you need to do this in a partial class.

Using the Original Metadata Classes

WCF RIA Services supports the ability to annotate persistent classes and properties. Annotations are implemented with partial classes called metadata classes. If you have added metadata classes for the original domain service, you can re-use them.

API Differences

All API differences should be fixed manually. For example, the LinqToEntitiesDomainService<T> class exposes the underlying context through a property named ObjectContext. In the OpenAccessDomainService<T> class, the equivalent property is named DomainContext.

References

For further reference, see the RIA Services section.