RIA: how to get functionality, not a data

Posted by Budda on Stack Overflow See other posts from Stack Overflow or by Budda
Published on 2010-03-28T21:18:35Z Indexed on 2010/03/28 21:23 UTC
Read the original article Hit count: 377

Filed under:
|

On the server side I have the following class:

public class Customer
{
    [Key]
    public int Id { get; set; }

    public string FirstName { get; set; }

    public string SecondName { get; set; }

    public string FullName { get { return string.Concat(FirstName, " ", SecondName); } }
}

The problem is that each field is calculated and transferred to the client, for example 'FullName' property:

    [DataMember()]
    [Editable(false)]
    [ReadOnly(true)]
    public string FullName
    {
        get
        {
            return this._fullName;
        }
        set
        {
            if ((this._fullName != value))
            {
                this.ValidateProperty("FullName", value);
                this.OnFullNameChanging(value);
                this._fullName = value;
                this.RaisePropertyChanged("FullName");
                this.OnFullNameChanged();
            }
        }
    }

Instead of data transferring (that is traffic consuming, in some cases it introduces significant overhead). I would like to have a calculation on the client side.

Is this possible without manual duplication of the property implementation?

Thank you.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about ria