.NET Core 3.1, EF Core 5.0 preview 6
Hello,
I have Foreign Key, but don't want to have Index for this property (I need to create this same Database as from "classic" EF 6).
My configuration:
entity.HasOne(d => d.Tenant)
.WithMany()
.HasForeignKey(d => d.TenantId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_MyFKName");
But this creates:
CONSTRAINT [FK_MyFKName] FOREIGN KEY ([TenantId]) REFERENCES [dbo].[Tenant] ([TenantId])
CREATE NONCLUSTERED INDEX [IX_Contact_TenantId]
ON [dbo].[Contact]([TenantId] ASC);
GO
How to disable creating Index? Or this was incorrect in EF Classic and I must have both FK and Index?