I can\'t find way to add a unique constraint to my field with using attribute:
public class User
{
[Required]
public int Id { get; set; }
[Requi
For someone who is trying all these solution but not working try this one, it worked for me
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity().Property(t => t.Email).HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute("IX_EmailIndex") { IsUnique = true }));
}