question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Newest EFCore Beta1 : Scaffold-DbContext generates multiple indices which fails during query

See original GitHub issue

I have multiple columns with 2 indices of the same name, but different column order. When Scaffold-DbContext generates the code on a database first approach, I get the following code. Since 2 indices share the same name, I’m unable to run a query against this table and get a InvalidOperationException. The same thing is true for any table with this condition.

        modelBuilder.Entity<VtColumnGroupColumn>(entity =>
        {
            entity.ToTable("VT_COLUMN_GROUP_COLUMN", "CORE");

            ..... Index and property definitions here .....

            entity.HasIndex(e => new { e.ColumnGroupId, e.ColumnId })
                .HasName("VT_COL_GP_COL_UNQ1")
                .IsUnique();

            entity.HasIndex(e => new { e.ColumnId, e.ColumnGroupId })
                .HasName("VT_COL_GP_COL_UNQ1")
                .IsUnique();

            entity.Property(e => e.ColumnGroupId)
                .HasColumnName("COLUMN_GROUP_ID")
                .HasColumnType("NUMBER(24)");

            entity.Property(e => e.ColumnId)
                .HasColumnName("COLUMN_ID")
                .HasColumnType("NUMBER(24)");

        });

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
alexkehcommented, Jun 5, 2020

@fsmirne We’ve been able to reproduce the problem now and are determining how to fix the bug.

1reaction
alexkehcommented, Jun 4, 2020

Thanks! I’m asking my dev team to review this trace. I’ll get back to you @fsmirne

Read more comments on GitHub >

github_iconTop Results From Across the Web

EF Core: Scaffold DbContext keeps failing
I've encountered the same problem. For me it was EntityFrameworkCore.Tools that was missing and did not properly install through NuGet.
Read more >
Breaking changes in EF Core 7.0 (EF7)
Complete list of breaking changes introduced in Entity Framework Core 7.0 (EF7)
Read more >
Oracle EF Core 3.1 Beta 2 Now Available | by Alex Keh
Bug 31446343 — EF CORE: 3.1: SCAFFOLDING GENERATES 2 INDEXES WITH SAME NAME FROM COMPOSITE INDEX; Bug 31455464 — EFCORE: 2.X MIGRATIONS SCRIPT...
Read more >
Learning EF - Error running Scaffold-DbContext
I am learning how to user Entity Framework where the models are built from an existing SQL server. I ran this command in...
Read more >
Entity Framework Core 5 - Pitfalls To Avoid and Ideas to Try
In this post, we'll look at some pitfalls and ideas EF Core users like yourself may want to consider when developing an application....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found