Skip to content

DB-first generation leads to incorrect DeleteBehavior mapping #508

@teejay-87

Description

@teejay-87

All my relations have ON DELETE set to RESTRICT.

When generating code with a DB-first approach using:

dotnet ef dbcontext scaffold "<connstring>" Npgsql.EntityFrameworkCore.PostgreSQL

in Context.cs I get:

entity.HasOne(d => d.ContactPerson) .WithMany(p => p.Registrations) .HasForeignKey(d => d.ContactPersonId) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("contact_persons_fkey");

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions