Store computed property with Entity Framework Core

You can use fluent api to compute it on sql server

class MyContext : DbContext
{
    public DbSet<Box> Box { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Box>()
            .Property(p => p.Volume)
            .HasComputedColumnSql("[Height] * [Width] * [Depth]");
    }
}

Below is the response I got from EF guys for the same problem:

Starting with EF Core 3.0, EF reads and writes directly to the backing field, where possible. EF can be configured to use the property instead, at which point the computed value will be read from the property and hence written to the database:

 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     modelBuilder
         .Entity<Box>()
         .Property(e => e.Volume)
         .UsePropertyAccessMode(PropertyAccessMode.Property);
 }

or

modelBuilder.UsePropertyAccessMode(PropertyAccessMode.PreferFieldDuringConstruction);

Read more: https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/breaking-changes#backing-fields-are-used-by-default