Calculated fields on the server side

Hi @semafox,

Yes, you can create a partial class and add the new property. However there are a few other things required. Here is the full procedure of adding a FullName property to the Employee entity from the Northwind database (that already has FirstName and LastName properties).

  1. Create a partial class in the server\models\Northwind\ directory and add the property (the empty setter is needed):
    public partial class Employee
    {

        public string FullName
        {
            get
            {
                return this.FirstName + " " + this.LastName;
            }

            set
            {
            }
        }
    }
  1. Create a new partial class that will extend the EF context in order to tell it to ignore that calculated property:
    public partial class NorthwindContext
    {
        partial void OnModelBuilding(ModelBuilder builder)
        {
            builder.Entity<Employee>().Ignore(e => e.FullName);
        }
    }
  1. Finally use that property in Radzen. It won't display in autocomplete and dropdowns so you have to type it in:

In the end the computed property should display in a DataGrid like this: