Skip to content

DB Scaffold Misnamed Navigation Properties ending in "Uuid" #38767

Closed

Description

@Pearseak

dotnet 7 & 8 (AFAIK)
The Entity Framework Core database scaffold has incorrectly named the navigation properties in the Choice entity.
The properties FileUu and QuestionUu do not align with their respective foreign keys, FileUuid and QuestionUuid.

        modelBuilder.Entity<Choice>(entity =>
        {
            entity.HasKey(e => e.Uuid).HasName("choice_pk");

            entity.ToTable("choice");

            entity.Property(e => e.Uuid)
                .HasDefaultValueSql("uuid_generate_v4()")
                .HasColumnName("uuid");
            entity.Property(e => e.FileUuid).HasColumnName("file_uuid");
            entity.Property(e => e.IsCorrect)
                .HasDefaultValue(false)
                .HasColumnName("is_correct");
            entity.Property(e => e.QuestionUuid).HasColumnName("question_uuid");
            entity.Property(e => e.Text).HasColumnName("text");

            entity.HasOne(d => d.FileUu).WithMany(p => p.Choice)
                .HasForeignKey(d => d.FileUuid)
                .HasConstraintName("choice_file_uuid_fk");

            entity.HasOne(d => d.QuestionUu).WithMany(p => p.Choice)
                .HasForeignKey(d => d.QuestionUuid)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("choice_question_uuid_fk");
        });
public class Choice
{
    public Guid Uuid { get; set; }
    public Guid QuestionUuid { get; set; }
    public string? Text { get; set; }
    public Guid? FileUuid { get; set; }
    public bool? IsCorrect { get; set; }

    public virtual File? FileUu { get; set; }

    public virtual Question QuestionUu { get; set; } = null!;
}

Activity

  1. changed the title [-]DB Scaffold Misnamed Navigation Properties[/-] [+]DB Scaffold Misnamed Navigation Properties ending in "Uuid"[/+] on Aug 14, 2026
  2. added this to the Backlog milestone on Aug 14, 2026
  3. added theissue type on Aug 14, 2026
  4. z0rimo commented on Sep 5, 2026

    @z0rimo
    Contributor

    Hi, I'd like to work on this issue.

    I reproduced the behavior on the current main branch:
    FileUuid is scaffolded as FileUu, and QuestionUuid as QuestionUu.

    The issue appears to be in CandidateNamingService.StripId(), which handles the Guid suffix specially but not Uuid.

    I have a minimal fix locally with regression coverage in CandidateNamingServiceTest.

  5. added 2 commits that reference this issue on Sep 5, 2026
    1b5ad2b
    34684d3
  6. modified the milestones: Backlog, 12.0.0 on Sep 10, 2026
  7. added a commit that references this issue on Sep 10, 2026
    76746ab
  8. added a commit that references this issue on Sep 25, 2026
    bf07e37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions