EF 索引时间:2023-03-08 15:54:32 public class CustomerMap : EntityTypeConfiguration<Customer> { public CustomerMap() { this.Property(o => o.UserName).HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute() { IsUnique = true })); } }