Home > Net >  How to change order of generated table columns EF Core 5?
How to change order of generated table columns EF Core 5?

Time:11-01

I need to change an order of code first generated columns in EF Core. I have tried deleting database and re-creating it with dotnet ef database update command, but it keeps this weird order. Is there a way to fix an order without applying attributes?

enter image description here

CodePudding user response:

EF Core 6 has this possibility https://github.com/dotnet/EntityFramework.Docs/issues/3469

builder.Property(x => x.Some)
  .HasColumnOrder(1);

Prior versions requires defining order via ColumnAttribute

  • Related