Skip to content

scaffolding: computed column does not include HasComputedColumnSql. #9

@olavloite

Description

@olavloite

The current scaffolding generator ensures that a valid DbContext that can be used is generated. If we also include the computed SQL in the meta model, EF Core will not respect the ValueGeneratedOnAddOrUpdate part of the meta model, and will try to insert values into the computed column. Cloud Spanner does not allow that.

Query:
FullName STRING(400) NOT NULL AS (COALESCE(FirstName || ' ', '') || LastName) STORED,

Actual:

entity.Property(e => e.FullName)
    .IsRequired()
    .HasMaxLength(400)
    .ValueGeneratedOnAddOrUpdate();

Excepted:

entity.Property(e => e.FullName)
    .IsRequired()
    .HasMaxLength(400)
    .ValueGeneratedOnAddOrUpdate()
    .HasComputedColumnSql("(COALESCE(FirstName || ' ', '') || LastName) STORED");

Metadata

Metadata

Assignees

No one assigned

    Labels

    known limitationtype: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions