I'd like to add unique constraint using model builder in ASP.NET Core
- .NET 5
- EF Core 5..
Here is what I found:
modelBuilder.Entity<Ticker>()
.HasIndex(r => r.Name)
.IsUnique();
However after updating database it adds index instead of constraint. Is there the way to add constraint? Thanks for the answer.
