How to create a Clustered Index with Entity Framework Core

前端 未结 4 628
广开言路
广开言路 2020-12-10 12:53

From EF6.1, we have a way of specifying a clustered index on a property

public class Person 
{
  [Index(IsClustered = true, IsUnique = true)]
  public long U         


        
4条回答
  •  情书的邮戳
    2020-12-10 13:22

    Or this works too, say if you wanted to cluster by age...

                modelBuilder
                .Entity()
                .Property(t => t.Age)
                .HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute() { IsClustered = true}));
    

提交回复
热议问题