Add-Migration Created Columns Alphabetically Asp.Net Core 2.0

I created a model and executed the Add-Migration command in PMC. he created the columns in alphabetical order during the migration. After updating the sqlserver database, the table is also in alphabetical order. I want the same order that I used in my original model, and not in alphabetical order. I do not want to do this.

[Key, Column(Order=0)]
public int MyFirstKeyProperty { get; set; }

[Column(Order=1)]
public int MySecondKeyProperty { get; set; }

Since I have 70 properties in my table, and for a while this may exceed. and I'm not sure if this works or not. I searched a lot and just know that this is a problem with .Net Core2.0. It's true? Any solution? Thank you

+4
source share
2 answers

, EF. , .

:

  • .
  • Github, . , EfCore.Shaman.
  • T-SQL

    migrationBuilder.Sql( " XYZ (FirstKeyProperty INT NOT NULL, SecondKeyProperty int NOTNULL)" );

+3

, , ,

​​ 2.1.0. , , 2.1.0-preview1-final,

bricelam 9

0

Source: https://habr.com/ru/post/1685855/


All Articles