Hi EuroEager2008,
Please try to change your code below
modelBuilder.Entity<Entity>()
.ToTable("Entity") // Is this really neccessary to singularize the entity name?
.HasIndex(entity => new { entity.COL1, entity.COL2 }, "UniqueCOL1_COL2").IsUnique(true);
to
modelBuilder.Entity<Entity>()
.HasIndex(entity => new { entity.COL1, entity.COL2 }).IsUnique();
or
modelBuilder.Entity<Entity>().HasAlternateKey(entity => new [] {entity.COL1, entity.COL2}).HasName("UniqueCOL1_COL2");
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.