EntityFramework code first: Set order of fields

后端 未结 4 907
梦毁少年i
梦毁少年i 2020-12-09 08:26

I am using EntityFramework with the \"Code first\" approach with migrations.

I have successfully generated tables from my models, but the columns are being added in

4条回答
  •  天命终不由人
    2020-12-09 09:23

    Update: In EF Core 2.1, for the initial migration at least, columns are added to tables in the order in which the relevant properties are declared in their respective classes, rather than in alphabetical order. See here. But note that any subsequent Entity Framework migrations performed on the same tables won't change the column order of the columns created earlier.

提交回复
热议问题