Calculated fields on the server side

With the help of a colleague, I did find a solution to keep from having to innumerate all the properties.
I used the AutoMapper package and it works great.
For anyone interested, here is how it works.

  1. Run this from the command prompt, in the project server directory:
    dotnet add package AutoMapper
  2. In your Models > Northwind > Employee.Custom.cs (you have to Ignore Collections):
namespace Northwind.Models.NorthwindDb
{
  public partial class Employee
  {
    public string FullName { get; set; }
  }
  public class EmployeeProfile: AutoMapper.Profile
  {
    public EmployeeProfile()
    {
      CreateMap<Employee,Employee>()
        .ForMember(dest => dest.Employees1, opt => opt.Ignore())
        .ForMember(dest => dest.Orders, opt => opt.Ignore())
        .ForMember(dest => dest.EmployeeTerritories, opt => opt.Ignore())
        .ForMember(dest => dest.FullName,
          opt => opt.MapFrom(src => src.FirstName + " " + src.LastName)
        );
    }
  }
}
  1. In Controllers > NorthwindDB > EmployeeController.Custom.cs:
    using System.Linq;
namespace Northwind.Controllers.NorthwindDb
{
  using Northwind.Models.NorthwindDb;
  using AutoMapper.QueryableExtensions;

  public partial class EmployeesController
  {
    partial void OnEmployeesRead(ref IQueryable<Employee> items)
    {
      var config = new AutoMapper.MapperConfiguration(cfg => cfg.AddProfile<EmployeeProfile>());
      items = items.ProjectTo<Employee>(config);
    }
  }
}
  1. Then, to keep the ModelBuilder happy, here is my Data > NorthwindDBContext.Custom.cs file:
using Microsoft.EntityFrameworkCore;
using Northwind.Models.NorthwindDb;
namespace Northwind.Data
{
  public partial class NorthwindDbContext
  {
    partial void OnModelBuilding(ModelBuilder builder)
    {
      builder.Entity<Employee>().Ignore(e => e.FullName);
    }
  }
}

I think you could also just use [NotMapped] in the Model definition, instead of the last step. Not sure about that as I didn't try it.
Thanks, Dan