Newest EFCore Beta1 : Scaffold-DbContext generates multiple indices which fails during query
See original GitHub issueI 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:
- Created 3 years ago
- Comments:12 (8 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fsmirne We’ve been able to reproduce the problem now and are determining how to fix the bug.
Thanks! I’m asking my dev team to review this trace. I’ll get back to you @fsmirne