Browse Source

Update CodeFirst.NoExistLogic

SqlSugar5
sunkaixuan 2 years ago
parent
commit
a8f009b307
  1. 4
      Src/Asp.Net/SqlSugar/Realization/Dm/CodeFirst/DmCodeFirst.cs
  2. 4
      Src/Asp.Net/SqlSugar/Realization/MySql/CodeFirst/MySqlCodeFirst.cs
  3. 4
      Src/Asp.Net/SqlSugar/Realization/PostgreSQL/CodeFirst/PostgreSQLCodeFirst.cs
  4. 4
      Src/Asp.Net/SqlSugar/Realization/Sqlite/CodeFirst/SqliteCodeFirst.cs

4
Src/Asp.Net/SqlSugar/Realization/Dm/CodeFirst/DmCodeFirst.cs

@ -19,6 +19,10 @@ namespace SqlSugar
DbColumnInfo dbColumnInfo = this.EntityColumnToDbColumn(entityInfo, tableName, item);
columns.Add(dbColumnInfo);
}
if (entityInfo.IsCreateTableFiledSort)
{
columns = columns.OrderBy(c => c.CreateTableFieldSort).ToList();
}
}
this.Context.DbMaintenance.CreateTable(tableName, columns,true);
}

4
Src/Asp.Net/SqlSugar/Realization/MySql/CodeFirst/MySqlCodeFirst.cs

@ -25,6 +25,10 @@ namespace SqlSugar
DbColumnInfo dbColumnInfo = this.EntityColumnToDbColumn(entityInfo, tableName, item);
columns.Add(dbColumnInfo);
}
if (entityInfo.IsCreateTableFiledSort)
{
columns = columns.OrderBy(c => c.CreateTableFieldSort).ToList();
}
}
this.Context.DbMaintenance.CreateTable(tableName, columns,true);
}

4
Src/Asp.Net/SqlSugar/Realization/PostgreSQL/CodeFirst/PostgreSQLCodeFirst.cs

@ -29,6 +29,10 @@ namespace SqlSugar
DbColumnInfo dbColumnInfo = this.EntityColumnToDbColumn(entityInfo, tableName, item);
columns.Add(dbColumnInfo);
}
if (entityInfo.IsCreateTableFiledSort)
{
columns = columns.OrderBy(c => c.CreateTableFieldSort).ToList();
}
}
columns = columns.OrderBy(it => it.IsPrimarykey ? 0 : 1).ToList();
this.Context.DbMaintenance.CreateTable(tableName, columns,true);

4
Src/Asp.Net/SqlSugar/Realization/Sqlite/CodeFirst/SqliteCodeFirst.cs

@ -103,6 +103,10 @@ namespace SqlSugar
DbColumnInfo dbColumnInfo = this.EntityColumnToDbColumn(entityInfo, tableName, item);
columns.Add(dbColumnInfo);
}
if (entityInfo.IsCreateTableFiledSort)
{
columns = columns.OrderBy(c => c.CreateTableFieldSort).ToList();
}
}
this.Context.DbMaintenance.CreateTable(tableName, columns,true);
}

Loading…
Cancel
Save