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

How to: Add Non-Persistent Properties on the Client

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.

This topic describes how to customize the code generated on a WCF Plain Services client. In some cases for Plain Services, you want to add properties in the client project that are computed from other properties in the domain class. However, you cannot directly customize the generated code because your changes will be overwritten the next time you update your service reference. When you add non-persistent properties, the property only exists in the client project.

Adding Non-Persistent Properties

Suppose, you have a Telerik Data Access Domain Model and WCF Plain Service in your server project.

To add a non-persistent property:

  1. In the client project, add a new class with the same name and namespace as the entity proxy class you want to modify.
  2. Declare the class as partial.
  3. Add a new property or method that creates a new value based on one or more values in the entity proxy class.

The following example shows how to create a new non-persistent property for the Car entity:

namespace WcfPlainNonPersistentProperties.SCRService
{
   public partial class CarDto
   {
       public string Description
       {
           get
           {
               return this.Make + " " + this.Model;
           }
       }
   }
}
Namespace SCRService
    Partial Public Class CarDto
        Public ReadOnly Property Description() As String
            Get
                Return Me.Make & " " & Me.Model
            End Get
        End Property
    End Class
End Namespace

Make sure that your class has the same name and namespaces as the entity proxy class you want to extend, and it is marked with the partial keyword.