1 在Nuget中引用 Toolbelt.EntityFrameworkCore.IndexAttribute
2 在DbContext中重写以下方法
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.BuildIndexesFromAnnotations(); base.OnModelCreating(modelBuilder); }
1 在Nuget中引用 Toolbelt.EntityFrameworkCore.IndexAttribute
2 在DbContext中重写以下方法
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.BuildIndexesFromAnnotations(); base.OnModelCreating(modelBuilder); }