Cannot create more than one clustered index on table

前端 未结 2 1283
北海茫月
北海茫月 2021-02-14 09:25

I am having the following error after typing update-database:

Cannot create more than one clustered index on table \'dbo.AppUsers\'. Drop the existing clu

2条回答
  •  感动是毒
    2021-02-14 09:39

    As stated by @gorillapower in comments, this piece of code is also very important.

    modelBuilder.Conventions.Add(new AttributeToColumnAnnotationConvention( "ServiceTableColumn", (property, attributes) => attributes.Single().ColumnType.ToString()));
    

    inside your

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    

    in the DbContext config class. Do not forget to regenerate migrations.

提交回复
热议问题